-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Add new cumulative_sum function to numpy and array_api namespaces #20756
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
Add new cumulative_sum function to numpy and array_api namespaces #20756
Conversation
1bfd146 to
b6f48c0
Compare
b6f48c0 to
f5fa5c1
Compare
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!
Also please add the new function to the docs by listing it here: https://github.com/google/jax/blob/main/docs/jax.numpy.rst
f5fa5c1 to
10d2ede
Compare
f111aa3 to
ff1a526
Compare
ff1a526 to
ceeb975
Compare
jakevdp
left a comment
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.
Looks good!
| if (dtype is None and kind in {'i', 'u'} | ||
| and x.dtype.itemsize*8 < int(config.default_dtype_bits.value)): | ||
| dtype = dtypes.canonicalize_dtype(dtypes._default_types[kind]) | ||
| x = x.astype(dtype=dtype or x.dtype) |
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.
Side-note: referencing the discussion in #20195, this is an example of a place where we wouldn't want copy in astype to default to True!
Towards #20200
Adds a new
cumulative_sumfunction to thejax.numpyandjax.experimental.array_apinamespaces in compliance with the array API 2023 standard.