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

RFC: add support for computing the cumulative product to the standard #598

Closed
steff456 opened this issue Feb 14, 2023 · 2 comments · Fixed by #793
Closed

RFC: add support for computing the cumulative product to the standard #598

steff456 opened this issue Feb 14, 2023 · 2 comments · Fixed by #793
Labels
API extension Adds new functions or objects to the API. RFC Request for comments. Feature requests and proposed changes. topic: Statistics Statistics.
Milestone

Comments

@steff456
Copy link
Member

steff456 commented Feb 14, 2023

This RFC requests to include a new API in the array API specification for the purpose of computing the cumulative product.

Overview

Based on array comparison data, the API is available in the majority of the libraries in the PyData ecosystem.

Prior art

Proposal:

def cumprod(x: array, /, *, axis: Optional[int] = None, dtype: Optional[dtype] = None) -> array
  • dtype kwarg is for consistency with sum et al

cc @oleksandr-pavlyk

@steff456 steff456 added the API extension Adds new functions or objects to the API. label Feb 14, 2023
@kgryte
Copy link
Contributor

kgryte commented Feb 14, 2023

@steff456 for the axis kwarg, this should be limited to just an int and not a Tuple. Based on the various docs, libraries seem to only support an int.

@kgryte
Copy link
Contributor

kgryte commented Feb 14, 2023

One thing to note is that PyTorch, e.g., requires an axis argument and does not support NumPy's default behavior of computing the cumulative sum over the flattened array.

@kgryte kgryte changed the title Add cumprod to the standard Add support for computing the cumulative product to the standard Feb 19, 2023
@kgryte kgryte added this to the v2023 milestone Jun 29, 2023
@kgryte kgryte removed this from the v2023 milestone Jan 11, 2024
@kgryte kgryte added this to the v2024 milestone Mar 21, 2024
@kgryte kgryte added the RFC Request for comments. Feature requests and proposed changes. label Apr 4, 2024
@kgryte kgryte changed the title Add support for computing the cumulative product to the standard RFC: add support for computing the cumulative product to the standard Apr 4, 2024
@kgryte kgryte added the topic: Statistics Statistics. label Apr 4, 2024
kgryte added a commit to kgryte/array-api that referenced this issue Apr 18, 2024
@kgryte kgryte closed this as completed in c492972 Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API. RFC Request for comments. Feature requests and proposed changes. topic: Statistics Statistics.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants