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

Miscellaneous fix for several numpy issues #16664

Merged
merged 7 commits into from
Oct 31, 2019
Merged

Conversation

haojin2
Copy link
Contributor

@haojin2 haojin2 commented Oct 29, 2019

Description

#16658 #16650 and inconsistent type when an array is created from an official numpy array:

from mxnet import np
import numpy as _np
a = np.array(_np.ones((3, ), dtype=_np.float16))
# a's dtype should be float16
# while the previous implementation it was float32
# after this fix it should become float16

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

Changes

  • Fix for expand_dims's boolean support
  • Fix for [Numpy] Boolean array bug #16658
  • Make resulting ndarray's dtype consistent with a source official numpy ndarray
  • corresponding tests

Comments

@haojin2 haojin2 added the Numpy label Oct 29, 2019
@haojin2 haojin2 requested a review from szha as a code owner October 29, 2019 09:17
@haojin2 haojin2 self-assigned this Oct 29, 2019
python/mxnet/numpy/multiarray.py Show resolved Hide resolved
python/mxnet/numpy/multiarray.py Show resolved Hide resolved
python/mxnet/numpy/multiarray.py Outdated Show resolved Hide resolved
src/operator/tensor/elemwise_unary_op.h Show resolved Hide resolved
@haojin2
Copy link
Contributor Author

haojin2 commented Oct 31, 2019

@eric-haibin-lin Good for merge?

@reminisce reminisce merged commit a6a9706 into apache:master Oct 31, 2019
yajiedesign pushed a commit to yajiedesign/mxnet that referenced this pull request Nov 6, 2019
* fix behavior of np.array when given official numpy ndarray

* bool for expand_dims and cast

* recover original Makefile

* address comments

* add boolean support for cumsum

* add gpu cast boolean support

* add error message
@haojin2 haojin2 deleted the np_fixes branch April 14, 2020 23:09
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.

4 participants