Skip to content
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

ENH: add broadcast_shapes #80

Closed
lucascolley opened this issue Jan 5, 2025 · 2 comments · Fixed by #133
Closed

ENH: add broadcast_shapes #80

lucascolley opened this issue Jan 5, 2025 · 2 comments · Fixed by #133
Labels
enhancement New feature or request new function
Milestone

Comments

@lucascolley
Copy link
Member

This is low priority, because you can just use https://numpy.org/doc/2.1/reference/generated/numpy.broadcast_shapes.html as the arguments are tuples. It would still be good to offer this for libraries which do not want to depend on NumPy.

@lucascolley lucascolley added enhancement New feature or request new function labels Jan 5, 2025
@lucascolley lucascolley linked a pull request Feb 5, 2025 that will close this issue
@crusaderky
Copy link
Contributor

crusaderky commented Feb 5, 2025

np.broadcast_shapes won't work when the arguments have None (ndonnx) or math.nan (Dask) in them.

xp.broadcast_arrays(...)[0].shape works, but is very weak about the guarantee that the backend won't perform a deep-copy of the input data upon broadcast.

@crusaderky
Copy link
Contributor

XREF data-apis/array-api#893

@lucascolley lucascolley added this to the 0.6.1 milestone Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new function
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants