Skip to content
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

Bug: slice assignment on multidimensional array produces out of bounds error when index within bounds #54

Open
tjad opened this issue Nov 27, 2020 · 3 comments

Comments

@tjad
Copy link

tjad commented Nov 27, 2020

Affects all versions.
Code to reproduce

require 'mxnet'

a = MXNet::NDArray.ones([5,5])
a[0, 0..4] = MXNet::NDArray.array([1,2,3,4,5])

Output:
git/mxnet.rb/lib/mxnet/ndarray.rb:232:in block in []=' IndexError (slicing stop 5 exceeds limit of 5)

@tjad
Copy link
Author

tjad commented Nov 27, 2020

This is only when using the full range of a column or row.

If doing a subslice assignment that does not include full row/column, the slice assignment works as expected.

@tjad tjad mentioned this issue Nov 30, 2020
tjad added a commit to Yobisense/mxnet.rb that referenced this issue Dec 6, 2020
@tjad
Copy link
Author

tjad commented Dec 6, 2020

@mrkn For this issue is only an incomplete feature. there was intent to incorporate exclude_end. this defaults to false currently and is not dynamic (still to be done).

int exclude_end;

Could we default this to true, or is the code reliant on this defaulting to false? - realise tests would need to change.

@tjad
Copy link
Author

tjad commented Dec 6, 2020

Ah, perhaps it's this, should be strictly >

elsif stop >= len

tjad added a commit to Yobisense/mxnet.rb that referenced this issue Dec 6, 2020
tjad added a commit to Yobisense/mxnet.rb that referenced this issue Dec 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant