Commit Graph
60 Commits
Author SHA1 Message Date
Haibin Lin a8e1912b59 Fix typo in __setitem__ doc (#10657) 2018-04-24 10:28:48 -07:00
daquexian f220ad07bb Fix typo in image.py (#10540)
Fix typo in image.py
2018-04-13 10:15:10 -07:00
Joshua Z. Zhang 549fd64518 [MXNET-306] Add slice_like operator (#10491)
* add slice_like and doc

* pass unittest and lint
2018-04-11 15:02:59 -07:00
Deokjae Lee ed7077af3e [MXNET-300] Fix ndarray assignment bug with index -1 (#10468)
* Fix ndarray assignment bug with index -1

* Add test cases for negative index
2018-04-10 10:26:26 -07:00
Deokjae Lee 6f6a1dc4d3 [MXNET-291] Fix an ndarray indexing bug with index -1 (#10440)
* Fix an ndarray indexing bug with index -1

* Add tests for ndarray slicing with negative index

* Test revise
2018-04-06 16:14:35 -07:00
Deokjae Lee 2ae0bd598b Fix typos in random number docs (#10423) 2018-04-05 15:20:16 -07:00
Hao Jin 73a0eb00c6 [MXNET-117] Sparse operator broadcast_mul/div(csr, dense) = csr (#10208)
* support broadcast_mul/div(csr, 1Ddense) = csr

* address code reviews and support broadcast_mul/div(csr, 2Ddense) = csr

* add test for both 1D and 2D dense case

* address code review and fix test error

* address code review and fix test error

* added proper overrides for basic arithmetic functions for sparse tensors.

* fix broadcast dimension

* address code reviews
2018-04-05 12:46:51 -07:00
Sheng Zha 9fee414882 extend ndarray in-place reshape (#10360)
* refactor reshapeshape

* add extended reshape to c_api

* fix for windows

* avoid arr buf for windows

* update
2018-04-03 23:07:22 -07:00
ThomasDelteil 5a480f0237 Update doc for ndarray (#10361)
* Update ndarray.py

* Update sparse.py

* Update ndarray.py

* Update sparse.py
2018-04-01 19:44:28 -07:00
ThomasDelteil 0291f95503 [MXNET-257] Do not copy when casting as same type (#10347)
* do not copy on same type when casting

* update to have a copy flag

* adding sparse array
2018-04-01 16:11:47 -07:00
Marco de Abreu b0a6760efa [MXNET-99] Upgrade CI to cuda 9.1 cudnn 7 (#10108)
* Upgrade to cuda 9.1 cudnn 7

* Pin pylint version

* Remove aws cli installation

* Address review comments
2018-03-21 14:30:06 +01:00
Deokjae Lee 9bbdc16f95 [MXNET-68] Random shuffle implementation (#10048)
* Random shuffle implementation

This operator randomly shuffles an NDArray along the first axis. The order of the elements in each subarray does not change. For exmaple, if an NDArray `x` is shuffled, the order of the subarrays `x[i]` randomly changes but the order of the elements in each `x[i]` does not change. It is modeled on `numpy.random.shuffle`.

In cpu, the shuffling of an 1D array is delegated to `__gnu_parallel::random_shuffle`, which utilizes openmp, for clang on linux and gcc on any OS and delegated to `std::shuffle` for other platforms. For an multidimensional array, the usual Fisher-Yates shuffling is implemented.

In gpu, it shuffles the array of indices representing the subarrays and then rearrange the elements of the data array according to the shuffled index array. To shuffle the index array, a random key is generated for each index and then the indices are sorted by the keys. The sorting is delegated to mshadow's `SortByKey` which again delegates the call to thrust's `sort_by_key`.

* Refactoring to avoid a preprocessing problem in Windows build

* Cosmetic changes

* Typo

* Adding const keyword at several places

* Fix the bug that integer arrays are not allowed

* Revise the comments to explain the unit test

* Add a check for correct array shape

* Revised unit test with larger arrays

* Replace the custom hash with 'str'

* Fix a bug due to the integer arithmetic in python2

* Revise comments for the unit test

* Fix the invalid fix in the commit f240714c

* Update random.md

* Update random.md
2018-03-20 15:30:30 -07:00
Haibin Lin 7b4594da6c Update an incorrect description in the API doc. (#10034)
* Update sparse.py

* Update Sparse.pm
2018-03-08 14:54:12 +01:00
reminisce 39c0fd8231 Fix ndarray assignment issue with basic indexing (#10022)
* Fix ndarray assignment issue with basic index

* Uncomment useful code
2018-03-08 01:40:04 -05:00
Tianqi Chen 3545697210 TVM bridge support to JIT NDArray Function by TVM (#9880)
* TVM bridge support.
Support wrap TVM compiled function as a NDArray function.

* Testcases and CI to include TVM as dependency

* address review comments

* Add more comments, change to constexpr

* change to log warn

* update comment on the type code
2018-02-27 08:41:28 -08:00
David Braude a352d1e2b3 added function for loading content of nd_array files from a buffer (#9883)
* added function for loading content of nd_array files

* changed function name and added check for NULL

* removed no lint

* fixed whitespace

* corrected the casting

* added python wrapper for buffer loading

* added unit tests for loading from buffer

* whitespace fixes

* fix for python 3

* fixed test for py3

* python 3 problems

* fixed test

* switched to using temp files

* better use of temp files

* hopefully fixed permission issue

* removed specified directory

* hopefully this will work with windows

* fixed indentation

* check in to relaunch tests

Python 3 windows failed for no obvious reason, deleted some whitespace to relaunch

* switched to using temporary directory class

* removed unneeded imports

* moved imports to 1 location
2018-02-26 11:48:11 -08:00
Ziyue Huang db24ac102c eye operator, for default storage type (#9770)
* eye

* more test

* change to two kernels

* address comments

* Update init_op.h
2018-02-26 10:36:51 -08:00
Haibin Lin 9158352ec3 Add contrib.rand_zipfian (#9747)
* draft

* move to contrib

* rename op

* CR comments

* Update contrib.py

* Update contrib.py

* Update random.py

* update example in the doc

* update example in symbol doc

* CR comments

* update op name

* update op name

* update op name in test

* update test

* Update contrib.py
2018-02-23 21:53:07 +08:00
Sheng Zha 9348a3ab94 make array.reshape compatible with numpy (#9790)
* make array.reshape compatible with numpy

* update

* add exception when both *args and **kwargs are specified

* update
2018-02-19 11:50:36 -08:00
reminisce ccb08fb5ca Add convenience fluent method for squeeze op (#9734)
* Add convenience fluent entry for squeeze op

* Add unit tests
2018-02-08 20:00:41 -08:00
Marco de Abreu fb8f607fc3 Fix lint (#9660)
* Fix pylint

* fix lint

* Fix pylint

* Fit typo

* Clarify return statement

* Fix typo
2018-02-01 21:18:25 -08:00
Junyuan Xie ab0d1d5ea1 lint 2018-01-22 12:43:26 -08:00
Hu Shiwen 3aef4e85bc [WIP]Image Augmenter (#8633)
* add file

* add random_brightness
add python mx.sym/nd.image

* fix lint

* add image/image_common.h

* add RandomContrast

* change name

* fix
2018-01-22 12:43:26 -08:00
Ziyue Huang 6c51629156 rsp[:] = const_value, used in constant initializer for rsp weight (#8891)
* rsp set to scalar

* add test for const init of rsp

* move set_rsp to ndarray_func

* remove PopulateFullIdxRspImpl in init_op.h
2017-12-05 10:21:59 -08:00
reminisce 55189860db Explicitly convert float value (#8758)
* Explicitly convert float value

* Add unit test function
2017-11-22 08:25:55 -08:00
reminisce 4dc893382c Fix docstring format (#8734) 2017-11-20 19:20:00 -08:00
Haibin Lin 257ad1d90d Doc updates for sparse operators (#8641)
* doc updates

* arithmetics and symbols

* add sparse embed to sym

* fix lint

* minor updates

* remove arithemtic changes

* remove unused test

* fix lint

* add note for optimizers

* misc-updates

* add check_fmt
2017-11-18 13:35:26 -08:00
reminisce 33698ea9c1 Fix sparse dot test failure due to launching kernel when nnr = 0 and bug of square_sum (#8470)
* Fix nnr = 0 crash for sparse dot

* Change comment

* Add sparse dot zero output unit test

* Fix test case

* Fix bug of square_sum

* Remove code

* Fix square_sum test case

* Fix broadcast min/max unit test failure

* Fix test

* Fix doc for __getitem__
2017-11-17 22:38:44 -08:00
Sheng Zha 4d05bff6ba ctypes speed improvement (#8642) 2017-11-16 15:19:10 -08:00
Eric Junyuan Xie 85d4bd2c81 multi processing and fork fix (#8677) 2017-11-16 15:13:31 -08:00
Ziyue Huang 710bf4e640 check_format of sparse ndrray (#8259)
* check_format of ndrray, mainly for csr

* push into engine and dummy CheckFormatImpl

* implementation

* move CHECK outside of engine

* remove unneccessary stream->Wait and address other comments

* fix auto

* refact and address comments, add more rsp checks and gpu unittest

* sync submodule

* fix

* address comments

* fix

* return imediately for zero rsp

* fix for comments

* update comments

* update

* trigger

* trigger

* Update test_sparse_ndarray.py

* Update test_sparse_ndarray.py
2017-11-14 21:20:47 -08:00
reminisce d8d2c3924f Continued Work on Advanced Indexing (#8246)
* Add step to ndarrays slice

* Support broadcasting indices

* Enhance advanced indexing

* Fix

* Support mix of basic and advanced indices

* Add unit test

* Change name

* Add comment

* Fix pylint

* Add one more test case

* Address comments

* Add __setitem__ support

* Fix bug and add unit test for __setitem__

* Add docstring

* Fix bug

* Fix bug

* Fix gpu compile

* Add value assignment type support for array-like objects

* Fix test cases

* Rewrite _slice_assign and _slice_assign_scalar using kernel launch and support step

* Replace _gather_nd for basic indexing with _slice_assign and _slice_assign_scalar

* Clean up and bug fix

* Fix lint and bug fix

* Add autograd unit test for getitem and fix a bug

* Fix indent and docstring
2017-11-13 11:30:35 -08:00
Anirudh Subramanian 63d5394c41 Add asscipy feature (#8362)
* Add asscipy support and coo format support

* Comment misalignment change

* Add documentation for Sparse NDarray

* Change comment

* Adding comments and support for dtype

* Modifying tests

* Add spsp None check

* Fix lint
2017-11-04 17:10:10 -07:00
Sheng Zha 8592e1cd3b add default hash to ndarray (#8476) 2017-11-01 10:32:24 -07:00
Chris Olivier 3552b95868 Optimizations to set_to, copy, fill ops (#8340)
* Fill optimizations

* Optimize IdentityCompute for CPU

* lint

* Fix unused type warning (#8316)

* remove unused variable

* CR comments

* CR comments

* Added _full operator

* Trigger build

* Trigger build

* Add _full to symbolic

* Merge conflict resolution fix

* lint

* Timing output for test_factorization_module when Verbose enabled (#8363)

* Timing output for test_factorization_module when Verbose enabled

* Trigger build

* Trigger build

* Trigger build

* Misc fixes for sparse distributed training (#8345)

* remove mshadow::range in init_op.h

* add unit test

* remove pass by ptr, add unit test for pull empty wieghts

* fix range in key partition

* remove wrong comment

* remove change for partition

* remove unused var

* add int64 to arange. add checkpointing example

* Fix the Readme (#8369)

* Allow test to converge (#8351)

* Allow test to converge

* Trigger build

* Trigger build

* Trigger build

* Update cudnn_algoreg-inl.h (#7988)

* [Perl] emulate Python zip() for Perl (#8192)

* [Perl] emulate Python zip() for Perl

* [Perl] retool zip() uses away from the callback form

* add profile option for frontend profiling to image script (#8171)

* add profile option for frontend profiling to image script

* Update image_classification.py

* Update image_classification.py

* Fix Typo (classification) (#8376)

Fix a typo in the example readme.

* Use omp_get_max_threads() when OMP_NUM_THREADS environment variable is set (#8379)

* CPU optimization for ActivationOp (#8296)

* CPU optimization for ActivationOp

Significant improvement on CPU (several magnitudes of order in some cases, especially on backward pass).
Very slight improvement on GPU.

OLD MSHADOW APPROACH
--------------------

CPU
===

Timing: 50 iterations of 10 calls, shape = [1,1,28,28]
Activation Operator CPU:  Timing [Forward] 18.948 ms, avg: 0.037896 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 1.658 ms, avg: 0.003316 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [1,3,28,28]
Activation Operator CPU:  Timing [Forward] 57.973 ms, avg: 0.115946 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 4.748 ms, avg: 0.009496 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,1,18,32]
Activation Operator CPU:  Timing [Forward] 703.446 ms, avg: 1.40689 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 56.255 ms, avg: 0.11251 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,3,18,32]
Activation Operator CPU:  Timing [Forward] 2107.77 ms, avg: 4.21554 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 168.483 ms, avg: 0.336966 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [20,3,128,128]
Activation Operator CPU:  Timing [Forward] 24122.2 ms, avg: 48.2443 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 1908.7 ms, avg: 3.8174 ms X 500 passes

GPU
===

Timing: 50 iterations of 10 calls, shape = [1,1,28,28]
Activation Operator GPU:  Timing [Forward] 1.637 ms, avg: 0.003274 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.665 ms, avg: 0.00333 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [1,3,28,28]
Activation Operator GPU:  Timing [Forward] 1.562 ms, avg: 0.003124 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.661 ms, avg: 0.003322 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,1,18,32]
Activation Operator GPU:  Timing [Forward] 1.635 ms, avg: 0.00327 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.702 ms, avg: 0.003404 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,3,18,32]
Activation Operator GPU:  Timing [Forward] 1.83 ms, avg: 0.00366 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 2.041 ms, avg: 0.004082 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [20,3,128,128]
Activation Operator GPU:  Timing [Forward] 2.08 ms, avg: 0.00416 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 2.688 ms, avg: 0.005376 ms X 500 passes

NEW MXNET_OP APPROACH
---------------------

CPU
===

Timing: 50 iterations of 10 calls, shape = [1,1,28,28]
Activation Operator CPU:  Timing [Forward] 80.748 ms, avg: 0.161496 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 1.176 ms, avg: 0.002352 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [1,3,28,28]
Activation Operator CPU:  Timing [Forward] 7.881 ms, avg: 0.015762 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 2.181 ms, avg: 0.004362 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,1,18,32]
Activation Operator CPU:  Timing [Forward] 111.48 ms, avg: 0.22296 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 5.408 ms, avg: 0.010816 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,3,18,32]
Activation Operator CPU:  Timing [Forward] 333.439 ms, avg: 0.666878 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 21.331 ms, avg: 0.042662 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [20,3,128,128]
Activation Operator CPU:  Timing [Forward] 3429.19 ms, avg: 6.85837 ms X 500 passes
Activation Operator CPU:  Timing [Backward] 286.324 ms, avg: 0.572648 ms X 500 passes

GPU
===

Timing: 50 iterations of 10 calls, shape = [1,1,28,28]
Activation Operator GPU:  Timing [Forward] 1.618 ms, avg: 0.003236 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.671 ms, avg: 0.003342 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [1,3,28,28]
Activation Operator GPU:  Timing [Forward] 1.629 ms, avg: 0.003258 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.728 ms, avg: 0.003456 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,1,18,32]
Activation Operator GPU:  Timing [Forward] 1.753 ms, avg: 0.003506 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.756 ms, avg: 0.003512 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [50,3,18,32]
Activation Operator GPU:  Timing [Forward] 1.704 ms, avg: 0.003408 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 1.791 ms, avg: 0.003582 ms X 500 passes

Timing: 50 iterations of 10 calls, shape = [20,3,128,128]
Activation Operator GPU:  Timing [Forward] 2.032 ms, avg: 0.004064 ms X 500 passes
Activation Operator GPU:  Timing [Backward] 2.143 ms, avg: 0.004286 ms X 500 passes

* lint

* Trigger build

* Trigger build

* Negative begin and end support for csr slice (#8241)

* negative index support for sparse slice

* fix lint

* getitem(int) for csr ndarray, support a[-1]

* remove unneccessary argument

* unittest and doc update

* Preparing for 0.12.0.rc0: Final changes before RC (#8301)

* Final changes before RC

* Updates to NEWS.md

* Updates

* Enable smoothing in softmax operator (#8125)

* v0.12 regression: Fix registration of children for Block (#8277)

* Fix Block not registering children

If the attribute was already set to something different than Block (e.g. None),
it was not being registered.

* fix if / elif for block children registration

* trigger test

* Add fix from #8152

* Add tests from #8152

* Revert "[CMAKE] Fix windows cmake build" (#8311)

* Revert "Added my code signing key (#8293)"

This reverts commit 22ab185bbf.

* Revert "[CMAKE] Fix windows cmake build (#8227)"

This reverts commit 1c1c788916.

* fixed broken links. https was pointing to http for mxnet.io (#8300)

* Update rnn.md (#8320)

* fluent methods for missed ops (#8329)

* update ps lite (#8327)

* Fix unused type warning (#8316)

* Trigger build

* Trigger build

* Misc fixes for sparse distributed training (#8345)

* remove mshadow::range in init_op.h

* add unit test

* remove pass by ptr, add unit test for pull empty wieghts

* fix range in key partition

* remove wrong comment

* remove change for partition

* remove unused var

* add int64 to arange. add checkpointing example

* Fix the Readme (#8369)

* Allow test to converge (#8351)

* Allow test to converge

* Trigger build

* Trigger build

* Trigger build

* Update cudnn_algoreg-inl.h (#7988)

* [Perl] emulate Python zip() for Perl (#8192)

* [Perl] emulate Python zip() for Perl

* [Perl] retool zip() uses away from the callback form

* add profile option for frontend profiling to image script (#8171)

* add profile option for frontend profiling to image script

* Update image_classification.py

* Update image_classification.py

* Fix Typo (classification) (#8376)

Fix a typo in the example readme.

* Fix GPU copy

* Remove duplicate

* Trigger build
2017-10-27 18:50:36 -07:00
Haibin Lin 171fd83e22 dtype default to source_array.dtype for sparse ndarrays (#8403)
* derive default dtype/ctx from input for sparse ndarrays

* add gpu tests

* fix lint. add doc

* remove default_ctx code

* bug fix when passing dtype to array()

* update doc

* remove extra line

* also check ctx
2017-10-24 21:09:05 -07:00
Sheng Zha dd3853f997 fluent methods for missed ops (#8329) 2017-10-17 22:57:20 -07:00
Ziyue Huang f3df4624a4 Negative begin and end support for csr slice (#8241)
* negative index support for sparse slice

* fix lint

* getitem(int) for csr ndarray, support a[-1]

* remove unneccessary argument

* unittest and doc update
2017-10-16 22:17:21 -07:00
Sheng Zha 99099faa24 generate op frontend code for IDE auto-complete (#8244)
* decouple codegen and register

* address comments on refactor

* auto generate code

* trigger test
2017-10-15 20:18:06 -07:00
Haibin Lin b1d8e7cb79 scipy style sparse ndarray constructor and misc sparse fixes (#8261)
* fix rowsparsepull usage in the example

* update csr_matrix interface

* update rowsparse tutorials

* update csr/rsp constructor code&doc

* doc & bug fixes

* fix empty

* bug fix for desnity=0

* fix lint

* add more unit tests

* reduce test run time

* update infer shape test

* add one more test case with list
2017-10-14 16:19:52 -07:00
Eric Junyuan Xie ffa6e45aad Fix arange (#8268)
* fix arange

* fix

* trigger test
2017-10-14 13:07:46 -07:00
Anirudh Subramanian 46ec178969 Operators for sum(csr, axis=0) and sum(csr, axis=1) (#8174)
* Add Infer storage for sparse slice operator

* Remove unused files

* Indentation fix and add gpu test for fallback

* Change sum builtin to py_sum

* Add sum_axis(csr,axis=0)=dense and sum(csr,axis=1)=dense operator

* Documentation changes for sparse

* Add fallback unittest for keepdims and exclude

* PR review based changes
:

* Fix CHECK_NE

* Change in_stype to int

* Using const int instead of int

* Initialize mid with the start
2017-10-13 14:08:13 -07:00
moin d22373b15e Gpu samplers (#8179)
* Samplers for GPU

* adjustments for GPU samplers
2017-10-10 12:32:48 -07:00
Sheng Zha 283378adbc correct boolean values for ndarray (#8104) 2017-10-01 11:30:30 -07:00
Sheng Zha db374b19d8 doc update (#8088)
* doc update

* keep blocks in nn namespace
2017-09-30 11:18:19 -07:00
Eric Junyuan Xie 198df2fb83 Update ndarray.py (#8083) 2017-09-28 19:48:22 -07:00
Haibin Lin 6452fe681e More sparse related docs (#7911)
* more sparse related docs

* fix lint

* fix grammar

* raise exception on unimplemented aux type for sparse
2017-09-27 14:27:20 -07:00
Eric Junyuan Xie 0ad14b6037 Random refactor (#7939)
* random refactor

* fix

* fix

* fix

* fix
2017-09-26 13:39:24 -07:00
Sheng Zha 22bea8878c add math fluent functions (#7992) 2017-09-22 15:31:16 -07:00
Eric Junyuan Xie 37a6516648 Second order gradient and Subgraph execution (#7698)
* refactor imperative invoke

* fix

* refactor

* add inferstorage

* fix storage type

* add req

* fix

* fix grad req

* support higher-order gradients

* fix

* refactor compiled

* add cachedop backward

* prioritize delete operation

* fix

* fix

* fix

* reset

* add plan memory

* reorg

* fix

* fix

* fix

* fix amal

* fix

* fix test

* fix

* fix

* Update test_gluon_rnn.py
2017-09-22 15:06:49 -07:00