mxnet icon indicating copy to clipboard operation
mxnet copied to clipboard

An empty NDArray should have size 0

Open ziyuang opened this issue 6 years ago • 14 comments
trafficstars

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 avatar Apr 17 '19 13:04 ziyuang

@ziyuang Can you add unittest for this change?

Roshrini avatar Apr 17 '19 16:04 Roshrini

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.

reminisce avatar Apr 19 '19 22:04 reminisce

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 avatar Apr 25 '19 10:04 ziyuang

@ziyuang Can you add unittest for this change?

Will add a standalone one under tests/cpp/misc/ if that's good for you

ziyuang avatar Apr 26 '19 07:04 ziyuang

@ziyuang please fill in the PR description template with relevant details about the changes

vandanavk avatar May 09 '19 05:05 vandanavk

@mxnet-label-bot add[pr-awaiting-response]

pinaraws avatar May 20 '19 16:05 pinaraws

@mxnet-label-bot remove[pr-awaiting-review]

pinaraws avatar May 20 '19 16:05 pinaraws

@ziyuang any update on the PR? Also please fill the PR description with relevant details.

abhinavs95 avatar May 28 '19 22:05 abhinavs95

@apeforest For review.

piyushghai avatar Jun 07 '19 22:06 piyushghai

@ziyuang any update on the PR?

Roshrini avatar Jun 23 '19 20:06 Roshrini

Hi, has this zero-size NDArray issue been handled well by https://github.com/apache/incubator-mxnet/pull/14661 already?

ziyuang avatar Jun 28 '19 09:06 ziyuang

@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.

karan6181 avatar Jul 19 '19 00:07 karan6181

@ziyuang Ping for an update.

piyushghai avatar Aug 02 '19 19:08 piyushghai

@ziyuang please trigger CI and update this PR?

roywei avatar Aug 19 '19 08:08 roywei