-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Behaviour change in 1.13 for expand_dims #9100
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
Comments
For anyone else confused by this: it sounds like the old behavior was not to insert multiple dimensions so that the resulting array indeed had 20 dimensions, but rather to silently pretend the call said Also definitely something that needs a nice long deprecation cycle to fix though... |
@eric-wieser Has this been fixed? |
No. Would appreciate if someone else could take this on. Should be a simple fix to limit the input to a.ndim |
I note that |
Mainly just that adding a public function would probably incur a mailing list discussion - whereas adding an internal helper does not. In particular, |
Expand_dims works as documented when the index of the inserted NewAxis in the resulting array satisfies -a.ndim - 1 <= index <= a.ndim. However, when index > a.ndim index is replaced by a.ndim and, when index < -a.ndim - 1, it is replaced by index + a.ndim + 1, which may be negative and results in incorrect placement. The latter two cases are now deprecated. Closes numpy#9100.
Expand_dims works as documented when the index of the inserted NewAxis in the resulting array satisfies -a.ndim - 1 <= index <= a.ndim. However, when index > a.ndim index is replaced by a.ndim and, when index < -a.ndim - 1, it is replaced by index + a.ndim + 1, which may be negative and results in incorrect placement. The latter two cases are now deprecated. Closes numpy#9100.
Expand_dims works as documented when the index of the inserted NewAxis in the resulting array satisfies -a.ndim - 1 <= index <= a.ndim. However, when index > a.ndim index is replaced by a.ndim and, when index < -a.ndim - 1, it is replaced by index + a.ndim + 1, which may be negative and results in incorrect placement. The latter two cases are now deprecated. Closes numpy#9100.
Uh oh!
There was an error while loading. Please reload this page.
From the mailing list, this used to succeed, but now fails, thanks to these lines in #8584.
This failing absolutely seems like correct behaviour to me - unfortunately, correctness is not the metric we get to use, as this breaks matplotlib (matplotlib/matplotlib#8610).
Evidently, we need to restore the old behaviour, but with a deprecation warning
The text was updated successfully, but these errors were encountered: