We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
array_api
Array._new(x)
x
Array
Describe the bug Array creation in array_api gives unexpected result for Array._new(x) when x is an Array.
To Reproduce
In [13]: x Out[13]: Arkouda Array ((10,), int64)[0 1 2 3 4 5 6 7 8 9] In [14]: y = xp.Array._new(x) In [15]: type(y) Out[15]: arkouda.array_api.array_object.Array In [16]: type(y._array) Out[16]: arkouda.array_api.array_object.Array
The text was updated successfully, but these errors were encountered:
Closes Bears-R-Us#3754: array_api gives unexpected result for Array._…
62a491a
…new(x) when x is an Array.
I investigated this a bit. It seems like the best solution might be to have an array_like type variable, something like this:
array_like
array_like = Union[numeric_scalars, pdarray, Sequence[pdarray]]
and restrict the Array._array object to the array_like type.
Array._array
However, this would require a refactor of a number of functions that call the attributes of _array. For example:
_array
def empty_like(x: Array, /, *, dtype: Optional[Dtype] = None, device: Optional[Device] = None) -> Array: """ Return a new array whose shape and dtype match the input array, without initializing entries. """ from .array_object import Array if device not in ["cpu", None]: raise ValueError(f"Unsupported device {device!r}") t = x.dtype if dtype is None else akdtype(dtype) return Array._new( pdarray( "__empty__", t, x._array.size, x._array.ndim, x._array.shape, x._array.itemsize, x._array.max_bits, ), empty=True, )
Sorry, something went wrong.
ajpotts
No branches or pull requests
Describe the bug
Array
creation inarray_api
gives unexpected result forArray._new(x)
whenx
is anArray
.To Reproduce
The text was updated successfully, but these errors were encountered: