Skip to content

squeeze'ing of all singleton dimensions? #382

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

Closed
pmeier opened this issue Jan 25, 2022 · 1 comment
Closed

squeeze'ing of all singleton dimensions? #382

pmeier opened this issue Jan 25, 2022 · 1 comment
Labels
Question General question.

Comments

@pmeier
Copy link

pmeier commented Jan 25, 2022

Currently the only valid inputs for the axis parameter of xp.squeeze() are an int or a tuple of them.

Both numpy and PyTorch (I have not looked at the other libraries) support calling squeeze without the axis parameter. In this case all singleton dimensions will be squeezed:

In [1]: import numpy as np
In [2]: a = np.empty((1, 2, 1, 3, 1, 4))
In [3]: a.squeeze().shape
Out[3]: (2, 3, 4)
In [4]: import torch
In [5]: torch.from_numpy(a).squeeze().shape
Out[5]: torch.Size([2, 3, 4])

Maybe we can add this to the spec?

@pmeier
Copy link
Author

pmeier commented Jan 25, 2022

Oops, #100.

@pmeier pmeier closed this as completed Jan 25, 2022
@kgryte kgryte added the Question General question. label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question General question.
Projects
None yet
Development

No branches or pull requests

2 participants