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

Numpy compatible diagflat operator #15468

Closed
wants to merge 70 commits into from
Closed

Numpy compatible diagflat operator #15468

wants to merge 70 commits into from

Commits on Jun 4, 2019

  1. [Do not review] [Do not merge] New numpy-compatible sum (#14739)

    * Add numpy namespace and initial impl of np.sum (not complete)
    
    * Clean up
    
    * Fix import error
    
    * numpy sum
    
    * add test and backward data type support
    
    * add license to test_numpy_op.py
    
    * improve test to reduce flakiness
    
    * fix sanity build
    
    * extra numeric test and imperative test
    
    * add error message for initial argument
    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    ffd690d View commit details
    Browse the repository at this point in the history
  2. [numpy] Infra for supporting numpy ops in imperative mode and Gluon A…

    …PIs (#14758)
    
    * Infra of new ndarray and symbol types for numpy operators
    
    * Rename
    
    * Fix import problem
    
    * Refactor
    
    * Remove redundant code
    
    * Add docstring
    
    * More on numpy ndarray and symbol
    
    * Override unimplemented methdos for ndarray and _NumpySymbol
    
    * Fix built-in methods of ndarray and _NumpySymbol
    
    * Fix test and sanity check
    
    * Fix pylint
    
    * Address cr comments
    
    * Add unit tests for ndarray and _NumpySymbol
    
    * Add _true_divide
    
    * Fix gpu build
    
    * Add future import division
    
    * More correct way of checking if an output is from a np compat op
    
    * Fix gpu build
    
    * Fix output ndarray/symbol types with at least one new ndarray/symbol
    
    * Modify true_divide doc
    
    * Fix flaky copying zero-size arrays via gpus
    
    * Fix zero size in gluon hybridize and zeros/ones symbol not creating new symbol type
    
    * Fix doc
    reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    2f71241 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    355254e View commit details
    Browse the repository at this point in the history
  4. [numpy] Numpy dot (#14831)

    * Numpy Dot case 1-4 + case 3.5 forward and 0.5 backward
    
    * Backward computation and test coverage
    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    7a12654 View commit details
    Browse the repository at this point in the history
  5. numpy-compatible mean (#14859)

    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    4325676 View commit details
    Browse the repository at this point in the history
  6. [numpy] Some np ops for d2l (#14924)

    * Add np transpose
    
    More ops and namespaces for submodules
    
    Add relu and sigmoid
    
    Add reshape
    
    Fix symbolic name mismatch
    
    Add maximum and minimum
    
    * Add convenience fluent method
    
    * Add ndarray.item()
    
    * Fix CI
    
    * Fix lint
    
    * Fix lint
    
    * Fix reshape gpu
    
    * Add example
    
    * Remove python notebook outputs
    
    * Remove notebook output
    
    * Add one more example
    reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    0ee508e View commit details
    Browse the repository at this point in the history
  7. [numpy] Refactor np modules (#14989)

    * Refactor
    
    * Initial refactoring
    
    * Fix notebook
    
    * Move numpy op check from backend to frontend
    
    * Add homogeneous ndarray check
    
    * Fix grouping inhomogeneous types of symbols
    
    * Improve error handling of different types of symbols as outputs
    
    * Fix test
    
    * Fix numpy test
    
    * Fix ci
    
    * Try to fix gpu ci failure
    reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    043f01e View commit details
    Browse the repository at this point in the history
  8. [numpy] Refactor np module (example runs through) (#15055)

    * Refactor notebook
    
    * notebook working with hybrid block
    
    * More refactoring
    
    * Remove unnecessary use_np_compat
    
    * Use class decorator to initialize numpy ndarrays in parameter.py
    
    * Clear notebook outputs
    
    * Improve np decorator
    
    * Remove npe op from optimizer
    
    * Fix CI
    
    * Fix functools.wraps issue in Python2
    
    * Fix ci
    reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    308bcc6 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    6e33cc1 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    877e0e9 View commit details
    Browse the repository at this point in the history
  11. Numpy-compatible stack (#15027)

    * numpy stack
    
    * migrate to use_np_shape
    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    9911675 View commit details
    Browse the repository at this point in the history
  12. Numpy Unary Ops (#15010)

    * Unary Ops
    
    * new version of unit tests
    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    ac92ec3 View commit details
    Browse the repository at this point in the history
  13. [numpy] Fix np branch after rebase (#15086)

    * Add np_array semantics for Gluon
    
    Fix notebook
    
    Fix sanity
    
    Fix gluon deferred infer shape
    
    Add np.random.uniform
    
    Add random normal
    
    Add boolean comparison ops
    
    Add np.ndarray indexing
    
    Reformat test ndarray indexing
    
    Fix unit tests
    
    Add one more test of indexing
    
    Fix sanity
    
    Enable amp test
    
    Add np.arange
    
    Revert cython unit test to ctypes
    
    Delete unnecessary use_np_shape decorator from test
    
    Rebase with numpy branch
    
    support range as index
    
    Fix python2 range type check
    
    Add argmax
    
    Disable clojure test
    
    * Fix ci
    
    * Add np.linalg.norm for ord='fro'
    
    * Fix pylint
    reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    0010c43 View commit details
    Browse the repository at this point in the history
  14. numpy concatenate (#15104)

    haojin2 authored and reminisce committed Jun 4, 2019
    Configuration menu
    Copy the full SHA
    aa5153f View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2019

  1. [WIP][numpy] Fix for D2L Chapters 2/3/4 (#15139)

    * Fix
    
    * Fix linear regression gluon
    
    * More fix
    
    * Fix pylint
    
    * Fix for chapter 4
    
    * Add np.add mul div mod pow sub and shuffle
    
    * Fix model selection, underfitting, overfitting
    
    * Fix weight decay
    
    * Fix dropout
    
    * Fix
    
    * Fix chapter 4
    reminisce authored Jun 5, 2019
    Configuration menu
    Copy the full SHA
    517451b View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2019

  1. [numpy] Fix d2l performance regression (#15173)

    * Add np array adapter decorator for layers
    
    * Fix performance regression caused by too many conversions between nd.NDArray and np.ndarray
    
    * Fix pylint
    
    * Fix test backward compatibility issue
    
    * Fix test_lambda
    reminisce authored Jun 7, 2019
    Configuration menu
    Copy the full SHA
    df47457 View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2019

  1. Fix (#15188)

    reminisce authored Jun 9, 2019
    Configuration menu
    Copy the full SHA
    4e1274f View commit details
    Browse the repository at this point in the history

Commits on Jun 12, 2019

  1. Configuration menu
    Copy the full SHA
    4ad56dc View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2019

  1. [numpy] Fix d2l chapter8 (#15237)

    * Add np op doc
    
    * Fix several issues
    
    * Add a N-D dot b 2D support
    
    * Simplify array creation api
    
    * Add swapaxes
    
    * Fix rnn gluon
    
    * More fix
    
    * Fix pylint
    
    * Delete
    
    * Fix mp windows
    reminisce authored Jun 13, 2019
    Configuration menu
    Copy the full SHA
    fb10e28 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2019

  1. fix for ch11 (#15244)

    haojin2 authored and reminisce committed Jun 14, 2019
    Configuration menu
    Copy the full SHA
    a00a2ce View commit details
    Browse the repository at this point in the history

Commits on Jun 17, 2019

  1. Numpy-compatible split (#15049)

    * numpy split
    
    * numpy split
    
    * unit test
    
    * unit test
    haojin2 authored and reminisce committed Jun 17, 2019
    Configuration menu
    Copy the full SHA
    93679fe View commit details
    Browse the repository at this point in the history
  2. [numpy] [DO NOT MERGE] Fix d2l chapters 9 and 13 (#15246)

    * Add npx batch_dot and topk
    
    * Text embedding uses numpy
    
    * Fix SoftmaxCrossEntropyLoss with np
    
    * Fix sentiment cnn
    
    * Fix pylint
    
    * Fix dot attention
    
    * Fix seq2seq attention
    
    * Add np.tile
    
    * Fix transformer
    
    * Fix ci
    
    * Fix ci and rebase
    reminisce authored Jun 17, 2019
    Configuration menu
    Copy the full SHA
    bf4dc33 View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2019

  1. [numpy] Fix d2l chapter 5 (#15264)

    * Fix parameter initializer
    
    * Add np.save and np.load
    
    * Fix read-write
    
    * Fix lint
    reminisce authored Jun 18, 2019
    Configuration menu
    Copy the full SHA
    96520cb View commit details
    Browse the repository at this point in the history

Commits on Jun 19, 2019

  1. Numpy compatible max (#15161)

    * numpy amax
    
    * weird cu file diff
    
    * fix the unit test error
    
    * fix gpu bug
    
    * minor fix
    
    * fix lint
    
    * remove scalar value check
    
    * fix the bug on unit test
    
    * fix the case () that breaks the kernel launch
    
    * add zero dimension unit test
    
    * revert the tuple change
    
    * use mshadow maximum
    
    * remove test zero
    
    * change the macro for now
    
    * change the cuda to use mashadow op
    
    * fix the broadcast_reduce_op_value.cu wrong kernel
    
    * add more logic in shape to detect the invalid situation
    
    * change back to type swtich
    
    * change to as_nd_ndarray
    
    * add missing @npx.use_np_shape
    
    * retrigger CI
    
    * address the comment
    
    * undo algorithm import
    
    * remove the numeric gradient check
    stu1130 authored and reminisce committed Jun 19, 2019
    Configuration menu
    Copy the full SHA
    3409578 View commit details
    Browse the repository at this point in the history

Commits on Jun 20, 2019

  1. Numpy compatible multinomial (#15219)

    * draft of multinomial
    
    * rename to more concise name
    
    * finish shape
    
    * complete the forward function
    
    * complete forward without handle 0 dimension & scalar
    
    * handle 0 dimension
    
    * add new line
    
    * fix lint
    
    * fix the build error
    
    * fix lint
    
    * finish unit test
    
    * change the registration
    
    * make multinomial support pvals as mx.ndarray
    
    * delete newline
    
    * fix lint error
    
    * support input as list, mx.ndarray, np.ndarray & unit test
    
    * fix lint
    
    * fix the include error
    
    * fix lint
    
    * refactor & pass the tensor instead of tuple to kernel
    
    * fix lint
    
    * updata the doc
    
    * address the comment
    stu1130 authored and haojin2 committed Jun 20, 2019
    Configuration menu
    Copy the full SHA
    1b62426 View commit details
    Browse the repository at this point in the history
  2. Numpy compatible linspace (#15256)

    * draft
    
    * finish linspace implementation
    
    * finish linspace
    
    * delete newline
    
    * fix pylint
    
    * add more unit test
    
    * address comment
    
    * add more test case
    
    * disable too-many-arguments
    
    * resolve confliction
    
    * add ctx
    stu1130 authored and reminisce committed Jun 20, 2019
    Configuration menu
    Copy the full SHA
    2260667 View commit details
    Browse the repository at this point in the history

Commits on Jun 23, 2019

  1. numpy-compatible cumsum (#15309)

    haojin2 authored and reminisce committed Jun 23, 2019
    Configuration menu
    Copy the full SHA
    f803dde View commit details
    Browse the repository at this point in the history
  2. [numpy] Misc fix for other chapters (#15332)

    * Add np.prod
    
    * Fix ndarray.reshape accepting positional integers as arguments
    
    * Rebase
    
    * Fix rebase error
    
    * Add np.ndarray.flatten
    
    * Fix
    
    * Add broadcast_to
    
    * Add meshgrid and broadcast_arrays
    
    * Fix sin, cos, sinh, cosh not supporting scalars
    
    * Add more unary ops supporting python scalars
    
    * Fix
    
    * Fix
    
    * Fix ci
    
    * Fix sanity
    reminisce authored Jun 23, 2019
    Configuration menu
    Copy the full SHA
    a563b56 View commit details
    Browse the repository at this point in the history

Commits on Jun 27, 2019

  1. [numpy] Change d2l chapters cv and gan to use numpy (#15368)

    * Change op name style to lower case underscore
    
    * Add ops under image to npx
    
    * Add image submodule to npx
    
    * Fix split_and_load use np
    
    * Fix fine tuning
    
    * Fix bbox and anchor
    
    * Fix odd
    
    * Fix ssd and rcnn
    
    * Remove restriction on binary element-wise scalar
    
    * Fix gan
    
    * Fix sanity
    
    * Try to fix website build failure
    
    * Add npx.random.seed
    
    * Fix doc
    reminisce authored Jun 27, 2019
    Configuration menu
    Copy the full SHA
    6b7525c View commit details
    Browse the repository at this point in the history

Commits on Jun 28, 2019

  1. Configuration menu
    Copy the full SHA
    4dfb7b9 View commit details
    Browse the repository at this point in the history
  2. [numpy] Fix several places in numpy (#15398)

    * Fix
    
    * More fix
    reminisce authored Jun 28, 2019
    Configuration menu
    Copy the full SHA
    d60e105 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2019

  1. [numpy] fix cython (#15418)

    * add cython support for numpy
    
    * stay with original API for backward compatibility
    hzfan authored and reminisce committed Jul 2, 2019
    Configuration menu
    Copy the full SHA
    052f90d View commit details
    Browse the repository at this point in the history
  2. [numpy][doc-fix] sum, copy, tile, argmax, sign, log, degrees (#15382)

    * seven numpy docs finished
    
    * Style partly fixed
    
    * Style fixed; example output updated according to new output style
    
    * Style fixed; added scalar input support for np.tile
    
    * End of file spare line fixed
    
    * Fixed according to comments
    
    * Fixed according to comments
    
    * Removed dead code according to comment
    
    * `out` param comment modified
    
    * trailing newline fixed
    
    * Function signature override fixed
    
    * Mistype typo fixed
    
    * Removed duplicate functions due to rebase
    
    * Fixed signature of tile; minor refinement in style
    
    * Fixed tile typo for sanity check
    zoeygxy authored and reminisce committed Jul 2, 2019
    Configuration menu
    Copy the full SHA
    81747cb View commit details
    Browse the repository at this point in the history

Commits on Jul 3, 2019

  1. added untracked files

    endvroy committed Jul 3, 2019
    Configuration menu
    Copy the full SHA
    ab55a70 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9470a2c View commit details
    Browse the repository at this point in the history
  3. removed test script

    endvroy committed Jul 3, 2019
    Configuration menu
    Copy the full SHA
    9eca4db View commit details
    Browse the repository at this point in the history
  4. [numpy][doc-fix] mean, transpose, stack, split, log2, rint and radians (

    #15370)
    
    * Doc fix for split, stack, transpose, mean, rint, radians, log2.
    
    * Minor syntax fix
    
    * Add some disable=line-too-long to pass pylint test
    
    * Add Notes following the guide of example PR by Mu Li
    
    * Minor syntax fix
    
    * Fix a non-ascii character
    
    * Fix issues mentioned in review by @reminisce
    
    * Register mean into npi namespace and wrap it to have same sigatrue as
    standard numpy
    
    * Add mean to __all__ list
    
    * Note the imcompatibility of broacasting to output
    
    * Specify out must have the same type
    
    * Minor syntax fix
    
    * Clearify the `out` in symbol is only a dummy variable
    
    Fix the mess due to pull rebase
    
    Correct the wrong return statement in multiarray
    
    Again, syntax fix
    
    Syntax fix one more time
    Mike authored and haojin2 committed Jul 3, 2019
    Configuration menu
    Copy the full SHA
    44e5b25 View commit details
    Browse the repository at this point in the history

Commits on Jul 4, 2019

  1. [numpy][doc-fix] zeros_like, linspace, reciprocal, square, and arcsin (

    …#15377)
    
    * add _np_zeros_like
    
    some fix on '_np_zeros_like'
    add '_npi_linspace'
    
    try reciprocal
    
    improve `zeros_like`
    
    improve `linspace`
    
    try build
    
    try build by delete `see also` in python/mxnet/context.py
    
    square & reciprocal
    
    finish reciprocal
    
    finish square
    
    finish arcsin
    
    revert context.py
    
    fix 2 mistakes
    
    bug fix for `linspace` and render
    
    unify docs
    
    try _np_linspace
    
    fix some mistakes in _numpy_op_doc.py
    
    remove `see also` sections from symbol docs.
    remove _npi_linspace from _numpy_op_doc
    
    fix `_numpy_op_doc`.
    fix `zeros_like`
    
    fix `linspace`
    
    finish reciprocal.
    
    fix `square`.
    
    fix `arcsin`
    
    fix problems about pylint
    
    fix example in `linspace`
    
    fix something
    
    fix according to the comments
    
    remove linkless `see also`
    
    fix according to comments
    
    fix to pass sanity
    
    change signature of `linspace`
    
    fix a mistake
    
    * fix bug for build website
    
    * fix render of note of `reciprocal`
    hgt312 authored and haojin2 committed Jul 4, 2019
    Configuration menu
    Copy the full SHA
    e9b73e1 View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2019

  1. Configuration menu
    Copy the full SHA
    fb329be View commit details
    Browse the repository at this point in the history
  2. Numpy Trace (#15258)

    * add numpy compatible trace
    
    * add doc for trace
    hzfan authored and reminisce committed Jul 9, 2019
    Configuration menu
    Copy the full SHA
    546f3e8 View commit details
    Browse the repository at this point in the history

Commits on Jul 10, 2019

  1. [Numpy] Numpy compatible argsort (#15501)

    * Add numpy compatible argsort
    
    * Minor syntax fix
    Mike authored and reminisce committed Jul 10, 2019
    Configuration menu
    Copy the full SHA
    1bff19b View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2019

  1. Configuration menu
    Copy the full SHA
    19c7c6e View commit details
    Browse the repository at this point in the history
  2. numpy eye op (#15282)

    address the comment
    stu1130 authored and haojin2 committed Jul 12, 2019
    Configuration menu
    Copy the full SHA
    3ea5f8c View commit details
    Browse the repository at this point in the history
  3. [Numpy] Numpy hstack (#15302)

    * Add numpy compatible hstack that currently pass CPU tests
    
    Regsiter hstack in GPU
    
    Rgister backward function to GPU
    
    Add some comments
    
    Fix the issues pointed out in code review
    
    Minor syntax fix according to comments
    
    Add docs
    
    * Minor syntax fix
    Mike authored and haojin2 committed Jul 12, 2019
    Configuration menu
    Copy the full SHA
    a26b201 View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2019

  1. Configuration menu
    Copy the full SHA
    5c89a52 View commit details
    Browse the repository at this point in the history
  2. shape inference completed

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    09ccb0b View commit details
    Browse the repository at this point in the history
  3. fixed bugs in shape inference

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    18ab342 View commit details
    Browse the repository at this point in the history
  4. fixed typo

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    27a259e View commit details
    Browse the repository at this point in the history
  5. first version of forward

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    083666d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    0bdbe91 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    fff7d09 View commit details
    Browse the repository at this point in the history
  8. added tests for forward

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    230d322 View commit details
    Browse the repository at this point in the history
  9. fixed array access error

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    9598847 View commit details
    Browse the repository at this point in the history
  10. fixed bugs in test

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    b9c8993 View commit details
    Browse the repository at this point in the history
  11. fixed bug in shape dim check

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    0165505 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    b6f31c9 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    87054c7 View commit details
    Browse the repository at this point in the history
  14. backward completed and tested

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    470ae2e View commit details
    Browse the repository at this point in the history
  15. fixed bug in backward

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    00dde0d View commit details
    Browse the repository at this point in the history
  16. added gpu support

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    3737f0a View commit details
    Browse the repository at this point in the history
  17. reformatted

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    cfbf7f8 View commit details
    Browse the repository at this point in the history
  18. removed unused var

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    226d920 View commit details
    Browse the repository at this point in the history
  19. Configuration menu
    Copy the full SHA
    22cd5ed View commit details
    Browse the repository at this point in the history
  20. fixed bug on gpu

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    38bee62 View commit details
    Browse the repository at this point in the history
  21. several code style fixes

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    0c72766 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    16c7f3c View commit details
    Browse the repository at this point in the history
  23. added doc for diagflat

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    9f0b54a View commit details
    Browse the repository at this point in the history
  24. moved diagflat to init_op

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    f0dba73 View commit details
    Browse the repository at this point in the history
  25. removed redundant blank lines

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    d94d664 View commit details
    Browse the repository at this point in the history
  26. merged np_init.h

    endvroy committed Jul 15, 2019
    Configuration menu
    Copy the full SHA
    df05a4f View commit details
    Browse the repository at this point in the history