Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Conversation

@asitstands
Copy link
Contributor

Description

This is a sequel of PR #10440. I missed that there is a same kind of bug with the assignment. For example, the following code causes an error. This PR fixes it.

x = mx.nd.array([[1,2,3],[4,5,6]])
x[-1,-1] = 10
print(x)

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to the relevant JIRA issue created (except PRs with tiny changes)
  • Changes are complete (i.e. I finished coding on this PR)
  • All changes have test coverage:
  • Unit tests are added for small changes to verify correctness (e.g. adding a new operator)
  • Nightly tests are added for complicated/long-running ones (e.g. changing distributed kvstore)
  • Build tests will be added for build configuration changes (e.g. adding a new build option with NCCL)
  • Code is well-documented:
  • For user-facing API changes, API doc string has been updated.
  • For new C++ functions in header files, their functionalities and arguments are documented.
  • For new examples, README.md is added to explain the what the example does, the source of the dataset, expected performance on test set and reference to the original paper if applicable
  • Check the API doc at http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

@asitstands asitstands requested a review from szha as a code owner April 9, 2018 15:12
@reminisce
Copy link
Contributor

Thanks for the fix. Could you add the test cases here as it's more comprehensive and generic than the legacy one?
https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_ndarray.py#L1088

@asitstands
Copy link
Contributor Author

@reminisce Sure, I'll do.

@asitstands asitstands changed the title Fix ndarray assignment bug with index -1 [MXNET-300] Fix ndarray assignment bug with index -1 Apr 10, 2018
@asitstands
Copy link
Contributor Author

@reminisce I added some cases covering this PR (negative index in basic indexing) and removed two duplicated cases.

@piiswrong piiswrong merged commit ed7077a into apache:master Apr 10, 2018
@asitstands asitstands deleted the fix_slicing_2 branch April 11, 2018 08:54
rahul003 pushed a commit to rahul003/mxnet that referenced this pull request Jun 4, 2018
* Fix ndarray assignment bug with index -1

* Add test cases for negative index
zheng-da pushed a commit to zheng-da/incubator-mxnet that referenced this pull request Jun 28, 2018
* Fix ndarray assignment bug with index -1

* Add test cases for negative index
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants