mxnet
mxnet copied to clipboard
An empty NDArray should have size 0
Description
(Brief description on what this PR is about)
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)
- [x] 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
Changes
- [ ] Feature1, tests, (and when applicable, API doc)
- [ ] Feature2, tests, (and when applicable, API doc)
Comments
- If this change is a backward incompatible change, why must this change be made.
- Interesting edge cases to note here
@ziyuang Can you add unittest for this change?
Can you confirm that an empty shape represents an empty ndarray in cpp-package? In Python and C++ backend, an empty shape actually represents a scalar tensor.
Can you confirm that an empty shape represents an empty ndarray in cpp-package? In Python and C++ backend, an empty shape actually represents a scalar tensor.
The expected behavior is to return 0 when the array is empty; now I do this check directly without touching the shape vector.
@ziyuang Can you add unittest for this change?
Will add a standalone one under tests/cpp/misc/ if that's good for you
@ziyuang please fill in the PR description template with relevant details about the changes
@mxnet-label-bot add[pr-awaiting-response]
@mxnet-label-bot remove[pr-awaiting-review]
@ziyuang any update on the PR? Also please fill the PR description with relevant details.
@apeforest For review.
@ziyuang any update on the PR?
Hi, has this zero-size NDArray issue been handled well by https://github.com/apache/incubator-mxnet/pull/14661 already?
@ziyuang Could you please see if #14661 fix your issue or not by running small reproducible code and installing the latest pre-release version of MXNet.
@ziyuang Ping for an update.
@ziyuang please trigger CI and update this PR?