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 ravel() (or flatten()) #658

Open
asmeurer opened this issue Jul 15, 2023 · 2 comments · May be fixed by #668
Open

RFC: add ravel() (or flatten()) #658

asmeurer opened this issue Jul 15, 2023 · 2 comments · May be fixed by #668
Labels
API extension Adds new functions or objects to the API. Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes. topic: Manipulation Array manipulation and transformation.

Comments

@asmeurer
Copy link
Member

Should we have a ravel() or flatten() function? Right now you can do it with reshape, but it's maybe not obvious. reshape also has the advantage in that it can be explicit about copying.

If not, I wonder if we should have some page or documentation somewhere to indicate the best workarounds for NumPy functions that aren't included in the standard, like "replace ravel(x) with reshape(x, (x.size,))".

@rgommers
Copy link
Member

If not, I wonder if we should have some page or documentation somewhere to indicate the best workarounds for NumPy functions that aren't included in the standard, like "replace ravel(x) with reshape(x, (x.size,))".

I'd prefer that - keeping the standard to one way of doing things. Such a page would be useful for many users. We may also add guidance for PyTorch/JAX/etc. users there as needed.

The question is where it should live. Maybe under the Other heading in the top-level structure (see https://data-apis.org/array-api/latest/index.html)?

@asmeurer
Copy link
Member Author

"replace ravel(x) with reshape(x, (x.size,))".

Correction. Should be "replace ravel(x) with reshape(x, (-1,))".

@steff456 steff456 linked a pull request Jul 30, 2023 that will close this issue
2 tasks
@kgryte kgryte changed the title ravel()/flatten() RFC: add ravel() (or flatten()) Apr 4, 2024
@kgryte kgryte added RFC Request for comments. Feature requests and proposed changes. API extension Adds new functions or objects to the API. topic: Manipulation Array manipulation and transformation. Needs Discussion Needs further discussion. labels Apr 4, 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. Needs Discussion Needs further discussion. RFC Request for comments. Feature requests and proposed changes. topic: Manipulation Array manipulation and transformation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants