-
-
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
squeeze() does not infer number of dimensions in output array #4270
Comments
For this to be possible a bit of rewriting would be necessary. Currently some corner cases are possible, such as:
The first one is probably unintentional, but the second one arguably makes sense, unless we want to enforce that squeeze must be able to remove dimensions. |
Enforcing that squeeze must be able to remove dimensions seems fine to me. Are there scenarios where one would want to squeeze a dimension that may or may not exist? It doesn't seem particularly unsafe, but it doesn't seem all that useful either, at least for the code I write. |
@StefanKarpinski explains the behavior here: https://groups.google.com/d/msg/julia-users/QQqVbyTiiPg/da5qkiMQVQIJ |
I think that post is about a different aspect of |
I think we should definitely fix |
Wow, I totally missed that--sorry for the noise. False positive on my FAQ alarm. |
e.g.
code_typed(squeeze, (Matrix{Float64}, Int))
suggests thatsqueeze
returns anArray{Float64,N}
, but it seems like it should be possible to infer that it will be anArray{Float64,1}
. This would be especially useful sincesqueeze
is the natural way to deal with singleton dimensions returned bysum
et al.The text was updated successfully, but these errors were encountered: