-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[1.4.0] unravel_index no longer works with magic '-1' in shape parameter as in 1.3.1 #13862
Comments
Thank you for submitting the issue! I'm labeling it so the MXNet community members can help resolve it. @mxnet-label-bot add [Python, Bug, NDArray] |
Could someone test this also with the 1.4 release candidate? If this is present there as well, I'd appreciate a last-minute fix very much! :) |
Hoping to get some activity on this.
There is no code change in the ravel.* files or the unravel_index op itself since its addition, so I would guess that some other type of change caused this unwanted regression; maybe unravel_index uses some outdated interface? The only commits where I could guess that they could have some effect on this: Unfortunately I don't have a way to bisect commits directly through source compilation right now. I would appreciate some support on this. Thanks! |
I can confirm that the problem exists in 1.4.0 |
Pretty easy to diagnose. The type for mshadow::index_t got changed from "unsigned" to "int64_t" between both versions. This type is used to encode dimensions of shapes internally. It is debatable whether we ever wanted to explicitly allow the use of "-1" in the shape argument of the operator. At least I as the original author had this not in mind and also the documentation does not say anything about magic numbers. In fact, the only case where the operator did work (and could ever work) with magic numbers is when "-1" is specified as first coordinate. Nothing else is possible.
|
Oh thank you so much! This is quite hilarious - we relied on exploiting this undocumented behavior without knowing :) |
PR #14356 will fix this. |
Description
The
unravel_index
op seems to no longer correctly work with 'magic' shape values, such as '-1's. The following example still works with mxnet 1.3.1, but does not on latest master (it returns all zeros in the result without throwing an error) or 1.4.0.We have a use case for this in Sockeye.
Environment info (Required)
macOs
MXNet commit hash:
pip-installed:
mxnet 1.5.0b20190111
Minimum reproducible example
Input data taken from Sockeye unit tests.
With mxnet==1.5.0b20190111, the result is incorrect:
With mxnet==1.3.1, the result is correct:
However, if the shape parameter is fully specified (
shape=(5,200)
),mxnet==1.5.0b20190111
returns the correct values.The text was updated successfully, but these errors were encountered: