8000 allow `dim=None` in `concat` · Issue #70925 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

allow dim=None in concat #70925

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

Open
Tracked by #58743
pmeier opened this issue Jan 6, 2022 · 3 comments
Open
Tracked by #58743

allow dim=None in concat #70925

pmeier opened this issue Jan 6, 2022 · 3 comments
Labels
module: python array api Issues related to the Python Array API module: viewing and reshaping triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@pmeier
Copy link
Collaborator
pmeier commented Jan 6, 2022

The array API specification stipulates that

  1. dim=None flattens all inputs before concatenating.
  2. negative dim's index the dimensions starting from the last one. False positive.

cc @mruberry @rgommers @pmeier @asmeurer @leofang @AnirudhDagar @asi1024 @emcastillo @kmaehashi

@pmeier pmeier added the module: python array api Issues related to the Python Array API label Jan 6, 2022
@ngimel ngimel added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 6, 2022
@mruberry
Copy link
Collaborator

What happens in PyTorch today when dim is None or negative?

@pmeier
Copy link
Collaborator Author
pmeier commented Jan 12, 2022
>>> torch.concat(torch.arange(5).split(1), dim=None)
RuntimeError: Please look up dimensions by name, got: name = None.

Negative indices are supported. That was a false positive from me running the array API test suite.

@pmeier pmeier changed the title change supported arguments for parameter dim in concat allow dim=None in concat Jan 12, 2022
@mruberry
Copy link
Collaborator

Looks like the error message is from named tensor support. We would accept a PR updating this behavior to be consistent with the Python Array API (and NumPy). We should add a SampleInput for it, too, and ensure the concat sample input references np.concatenate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: python array api Issues related to the Python Array API module: viewing and reshaping triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

No branches or pull requests

4 participants
0