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

[Numpy] Implement numpy operator 'average' #16720

Merged
merged 5 commits into from
Dec 9, 2019

Conversation

juxtaly
Copy link
Contributor

@juxtaly juxtaly commented Nov 4, 2019

Description

Implement the numpy operator 'average'

https://numpy.org/devdocs/reference/generated/numpy.average.html

Checklist

Essentials

Please feel free to remove inapplicable items for your PR.

  • 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 my best knowledge, examples are either not affected by this change, or have been fixed to be compatible with this change

Changes

  • op average, tests, (and when applicable, API doc)

Comments

  • does not guarantee the same behavior with numpy when given float16 dtype and overflow occurs
  • a and weights must be the same dtype

@juxtaly
Copy link
Contributor Author

juxtaly commented Nov 4, 2019

@haojin2

@haojin2 haojin2 added the Numpy label Nov 4, 2019
@haojin2 haojin2 added this to In progress in numpy via automation Nov 4, 2019
include/mxnet/tensor_blob.h Outdated Show resolved Hide resolved
python/mxnet/numpy/multiarray.py Show resolved Hide resolved
python/mxnet/numpy/multiarray.py Show resolved Hide resolved
python/mxnet/ndarray/numpy/_op.py Show resolved Hide resolved
python/mxnet/ndarray/numpy/_op.py Show resolved Hide resolved
Copy link
Contributor

@haojin2 haojin2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM @reminisce Any extra comments?

numpy automation moved this from In progress to Reviewer approved Nov 14, 2019
include/mxnet/tensor_blob.h Outdated Show resolved Hide resolved
include/mxnet/tensor_blob.h Outdated Show resolved Hide resolved
tests/python/unittest/test_numpy_op.py Outdated Show resolved Hide resolved
Add tests

Implement returned

Implement none weights returned

Replace reduce implementation with workspace version

Temp space can be requested only once.

Use FNumVisibleOutputs attribute, always return sum of weights

Fix bug

Fix GPU bug

Fix GPU bug

Formatting

Apply suggestions from code review

two blank lines between python functions

Fix pylint

Fix GPU bug

Add support for null and addTo reqs

Remove TBlob constructors

Refactor
@juxtaly
Copy link
Contributor Author

juxtaly commented Dec 8, 2019

@haojin2 ready to be merged

@haojin2 haojin2 merged commit 44cd63e into apache:master Dec 9, 2019
numpy automation moved this from Reviewer approved to Done Dec 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
No open projects
numpy
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants