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

[numpy] Fix mean, prod with input of empty array #18286

Merged
merged 6 commits into from
May 24, 2020

Conversation

Yiyan66
Copy link
Contributor

@Yiyan66 Yiyan66 commented May 12, 2020

Description

#16357 mean, prod

mean

>>> from mxnet import np, npx
>>> npx.set_np()
>>> a = np.array([]).reshape(2,0,0)
>>> np.mean(a)
[02:41:38] ../src/operator/numpy/np_broadcast_reduce_op.h:300: WARNING: Mean of empty slice.
array(nan)
>>> np.mean(a,dtype=int)
[02:41:55] ../src/operator/numpy/np_broadcast_reduce_op.h:300: WARNING: Mean of empty slice.
[02:41:55] ../src/operator/numpy/np_broadcast_reduce_op.h:307: WARNING: nan is outside the range ofrepresentable values of type 'int'
array(0, dtype=int64)

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 https://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
  • To the best of my 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

@mxnet-bot
Copy link

Hey @Yiyan66 , Thanks for submitting the PR
All tests are already queued to run once. If tests fail, you can trigger one or more tests again with the following commands:

  • To trigger all jobs: @mxnet-bot run ci [all]
  • To trigger specific jobs: @mxnet-bot run ci [job1, job2]

CI supported jobs: [centos-gpu, unix-gpu, edge, unix-cpu, miscellaneous, website, sanity, windows-cpu, clang, centos-cpu, windows-gpu]


Note:
Only following 3 categories can trigger CI :PR Author, MXNet Committer, Jenkins Admin.
All CI tests must pass before the PR can be merged.

@Yiyan66 Yiyan66 force-pushed the issue_mean branch 2 times, most recently from c85eec4 to 64cf4ef Compare May 14, 2020 05:13
@Yiyan66
Copy link
Contributor Author

Yiyan66 commented May 20, 2020

@mxnet-bot run ci [windows-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [windows-cpu]

@yzhliu yzhliu merged commit 9c2c5d4 into apache:master May 24, 2020
@yzhliu
Copy link
Member

yzhliu commented May 24, 2020

Thanks @Yiyan66

AntiZpvoh pushed a commit to AntiZpvoh/incubator-mxnet that referenced this pull request Jul 6, 2020
* prod

* mean

* nan

* sanity

* change kernel

* include

Co-authored-by: Ubuntu <[email protected]>
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