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

[NumPy]Set numpy default dtype #17283

Merged
merged 21 commits into from
Apr 28, 2020
Merged

Conversation

JiangZhaoh
Copy link
Contributor

@JiangZhaoh JiangZhaoh commented Jan 13, 2020

Description

Add new feature to be consistent with numpy default type.
For example, in original, default type only support 32 bit storage dtype such as float32 (or int32 in some special op). However, with this new feature, user can set 64 bit storage type as default dtype, such as float64 (int64 for some special op).
e.g.

import mxnet
from mxnet import numpy as np
from mxnet import npx
a=np.array([1, 2, 3])  # a.dtype = 'float32'
prev_state=npx.set_np_default_dtype()  # prev_state = False
b=np.array([1, 2, 3])  # b.dtype = 'float64'

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

@JiangZhaoh JiangZhaoh force-pushed the set_default_dtype branch 2 times, most recently from 995d347 to e21d8f2 Compare February 25, 2020 08:42
@JiangZhaoh JiangZhaoh force-pushed the set_default_dtype branch 6 times, most recently from 49ca61c to a363223 Compare March 3, 2020 08:04
@JiangZhaoh
Copy link
Contributor Author

@mxnet-bot run ci [windows-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [windows-cpu]

@JiangZhaoh
Copy link
Contributor Author

@mxnet-bot run ci [unix-gpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [unix-gpu]

@JiangZhaoh
Copy link
Contributor Author

@mxnet-bot run ci [windows-cpu]

@mxnet-bot
Copy link

Jenkins CI successfully triggered : [windows-cpu]

@JiangZhaoh
Copy link
Contributor Author

@mxnet-bot run ci [unix-gpu]

@yzhliu yzhliu merged commit 5c525c9 into apache:master Apr 28, 2020
sxjscience added a commit to sxjscience/mxnet that referenced this pull request Apr 29, 2020
@JiangZhaoh JiangZhaoh mentioned this pull request Apr 30, 2020
7 tasks
sxjscience added a commit that referenced this pull request Apr 30, 2020
JiangZhaoh added a commit to JiangZhaoh/incubator-mxnet that referenced this pull request May 6, 2020
@JiangZhaoh JiangZhaoh mentioned this pull request May 6, 2020
7 tasks
JiangZhaoh added a commit to JiangZhaoh/incubator-mxnet that referenced this pull request May 12, 2020
yzhliu pushed a commit that referenced this pull request May 19, 2020
* apply #17283

* fix issue #18060

* fix error

* remove redundant code

* fix CI error

* replace Flase to False

* add 'dtype=False' to set_np()

* fix doc

* default 'arange' default np dtype as int64
AntiZpvoh pushed a commit to AntiZpvoh/incubator-mxnet that referenced this pull request Jul 6, 2020
* draft 1

Preliminary completion

fix rebase mistake

* add new change

* use global flag & fix part of CI error

* fix CI error

* modify docs

* rebase

* consistent with FFI

* ones/full ffi

* arange ffi

* identity ffi

* depart set_np_default_dtype from set_np to test CI

fix sanity error

fix sanity error

* test CI

* fix CI error : use InitNumpyType instead of InitType / remove full ffi

fix sanity error

fix rebase error

* try to pass CI

* set the second output's dtype of normal to be float32

* modify ffi op

* update & rebase

* test windows CI

* comment test when platform is windows

* resolve comment

* add to set_np
AntiZpvoh pushed a commit to AntiZpvoh/incubator-mxnet that referenced this pull request Jul 6, 2020
AntiZpvoh pushed a commit to AntiZpvoh/incubator-mxnet that referenced this pull request Jul 6, 2020
* apply apache#17283

* fix issue apache#18060

* fix error

* remove redundant code

* fix CI error

* replace Flase to False

* add 'dtype=False' to set_np()

* fix doc

* default 'arange' default np dtype as int64
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.

5 participants