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

[numpy] add fallback ops #17609

Merged
merged 15 commits into from
Feb 19, 2020
Merged

[numpy] add fallback ops #17609

merged 15 commits into from
Feb 19, 2020

Conversation

Yiyan66
Copy link
Contributor

@Yiyan66 Yiyan66 commented Feb 16, 2020

Description

This PR implements a mechanism of easily falling back to the official NumPy if operators do not have the corresponding native implementations in MXNet. This allows us to quickly have a decent coverage of NumPy operators in order to test MXNet as a backend compute engine for other machine learning libraries heavily depending on NumPy, such as sklearn, while adding more operators with native implementations in parallel.

The mechanism implemented in this PR only supports calling operators in the imperative way without autograd, i.e., through the module mxnet.numpy. More sophisticated fallback mechanism for supporting symbolic paradigm and autograd should resort to #16923.

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

Copy link
Member

@eric-haibin-lin eric-haibin-lin left a comment

Choose a reason for hiding this comment

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

Could u add a summary of what are changed in this PR?

@reminisce
Copy link
Contributor

@eric-haibin-lin Description part updated.

@reminisce reminisce merged commit a11a9f9 into apache:master Feb 19, 2020
zheyuye pushed a commit to zheyuye/incubator-mxnet that referenced this pull request Feb 19, 2020
* Add fallback ops

* More fallback ops

* Add more fallback ops

* Fix astype

* Support mixed type of mx.np.ndarray and np.ndarray in binary ops

* More fix

* Add result_type

* Remove implemented ops

* Fix

* Add more tests

* fallback---------------

* 8

* all fallback

* ok

* delete repetition

Co-authored-by: reminisce <[email protected]>
anirudh2290 pushed a commit to anirudh2290/mxnet that referenced this pull request May 29, 2020
* Add fallback ops

* More fallback ops

* Add more fallback ops

* Fix astype

* Support mixed type of mx.np.ndarray and np.ndarray in binary ops

* More fix

* Add result_type

* Remove implemented ops

* Fix

* Add more tests

* fallback---------------

* 8

* all fallback

* ok

* delete repetition

Co-authored-by: reminisce <[email protected]>
@DickJC123
Copy link
Contributor

@Yiyan66 Did you intend to leave this line in the PR, as it prints whenever the file is imported:

https://github.com/apache/incubator-mxnet/tree/master/tests/python/unittest/test_numpy_interoperability.py#L2893

@eric-haibin-lin
Copy link
Member

I suggest that be removed..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants