-
Notifications
You must be signed in to change notification settings - Fork 52
PR: Add can-cast, broadcast-arrays and broadcast-to #132
New issue
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
Conversation
Thanks @steff456. Could you add a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs some changes; the most important points need comparison data before we can decide.
I noted some issues here that came up from my script that parses the function signatures. There are also similar issues in iinfo and finfo, if you want to fix them here (otherwise I will open a new PR for them). Some comments were marked as resolved but weren't actually resolved. |
I can update that in this PR. I haven't make a push with the changes but I already made them locally (: |
I have #133 but feel free to make the changes here too if you already made them. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this @steff456! Mainly formatting and phrasing nits. The main question for me is whether can_cast
should support dtypes
and arrays
for both from
and to
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR
can_cast
, which determines if a type conversion is allowed.broadcast_arrays
, which broadcast any number of arrays against each other.broadcast_to
, which broadcast an array to a new shape.Notes
can_cast
the minimal set of arguments was defined, omitting thecasting
argument which is currently supported in NumPy, CuPy and JAX, but which is not supported according to the type promotion specification. (https://github.com/data-apis/array-api-comparison/blob/main/signatures/data-types/can_cast.md)can_cast
the type of the first argument was reduced to the union ofdtype
andarray
, removing scalar support as supported by NumPy, Cupy and JAX. Scalars do not participate in type promotion according to the current array API specification. This is in contrast to NumPy, which uses value-based promotion.broadcast_to
the minimal set of arguments was defined, omitting thesubok
keyword argument currently supportedin NumPy,
chunks
keyword supported by Dask, andout
keyword supported by MXNet. (https://github.com/data-apis/array-api-comparison/blob/main/signatures/data-types/broadcast_to.md)broadcast_arrays
, the minimal set of arguments was defined, omitting the argumentsubok
currently supported in NumPy. (https://github.com/data-apis/array-api-comparison/blob/main/signatures/data-types/broadcast_arrays.md)