-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Have squeeze(A)
remove all singleton dimensions
#11838
Comments
Maybe we could just have this. Using it isn't always advisable since the result type isn't predictable and your code will therefore have corner cases when dimensions are accidentally singletons, but that could just be stated in the documentation for the |
I am not sure I agree with the argument against it because it would sometimes remove wanted singleton dimensions. If a user complains about a function doing the thing it was designed to do whose fault is it really? So long there is proper documentation I don't think its a problem. But perhaps we should distinguish it from |
A separate function would just make things harder to learn. It seems easier to remember a performance tip to specify squeezed dimensions, than to also have to remember to use a different function. Documentation also read better without cross references. |
+1 for adding the squeeze function that removes all singleton dimensions. I use this quite often in plotting code where I do not care in which direction a 3D dataset is sliced. One should aware of the issues but for REPL usage its handy |
Given that the more careful version is available, given adequate documentation of the dangers I can be persuaded. |
It seems like the most common use of
squeeze
is to remove all of the singleton dimensions. I would be nice to havesqueeze
called without thedims
argument do this. Perhaps something like this.The text was updated successfully, but these errors were encountered: