data-apis / array-api-strict

Strict implementation of the Python array API (previously numpy.array_api)
http://data-apis.org/array-api-strict/
Other
7 stars 4 forks source link

BUG: `full_like` accepts array `fill_value` #55

Open lucascolley opened 1 month ago

lucascolley commented 1 month ago
In [1]: import array_api_strict as xp

In [2]: xp.full_like(xp.asarray(0), xp.asarray(1))
Out[2]: Array(1, dtype=array_api_strict.int64)

Spec:

fill_value (Union[bool, int, float, complex]) – fill value.
asmeurer commented 1 month ago

This seems like it should be fixed in the standard. Getting a fill value from an array seems like it wouldn't be uncommon.

kgryte commented 1 month ago

Torch only accepts a scalar in full and full_like. To update the standard, I'd want to see upstream support added first.

lucascolley commented 1 month ago

Dask also throws a FutureWarning since its implementation uses np.copyto, which it says may stop working with dask arrays in the future.