[OP] Topk and arange + Update submodules #4565

Merged
merged 10 commits into from Jan 7, 2017

Projects

None yet

2 participants

@sxjscience
Member

Continuing of #4403

  1. Fix the argument of batch_dot
  2. New operators: topk, sort, argsort, arange. (Also, the previous internal operators _zeros and _ones have been added to the python script as mx.sym.zeros and mx.sym.ones)
  3. Move operator to operator/tensor: BlockGrad
  4. Add the argument dtype to initialization operators (_zeros, _ones, _arange)
  5. Enable gradient for argmax and argmin by adding the gradient node to _zeros.

Some Notes:

  1. The implementation of TopK is not so optimized at this stage. The implementation is to first sort the data and then keep the top k indices/values. In the future, we will try to refactor the implementation using CUB(https://nvlabs.github.io/cub/)
  2. The "axis" argument is supported in topk and topk is equivalent to argsort and sort if we set "k<1" and ret_typ = "indices" or "value"
  3. The arange operator has an additional "repeat" argument, which indicates the number of times each element will be repeated in the generation process. This can be helpful for implementing the "meshgrid".
sxjscience added some commits Jan 6, 2017
@sxjscience sxjscience initial add topk arange
fix arange

Put back ones and zeros

fix

fix default ctx
80892c1
@sxjscience sxjscience fix lint 6e914c6
@sxjscience sxjscience Update Submodules
9cc2388
+ batch_id = F<mshadow_op::floor>(indices / static_cast<real_t>(element_num));
+ // Since the SortByKey performs stable sort, the second SortByKey will reorder
+ // the sorted_dat based on the order of the batch_id
+ SortByKey(batch_id, sorted_dat, true);
@piiswrong
piiswrong Jan 6, 2017 Member

this is good for now. Let's try thrust later

@piiswrong
Member

LGTM. PLease fix warnings as they are treated as errors now.

sxjscience added some commits Jan 7, 2017
@sxjscience sxjscience Merge remote-tracking branch 'refs/remotes/dmlc/master' into topk_ara…
…nge_rebase5
5748463
@sxjscience sxjscience Update MShadow f7a303d
@sxjscience sxjscience fix warning
d0e5dbd
@sxjscience sxjscience fix pylint
57e5926
@sxjscience sxjscience Merge branch 'master' into topk_arange_rebase5
2dd24c2
@sxjscience sxjscience style fix
901db8a
@sxjscience sxjscience Merge branch 'master' into topk_arange_rebase5
312ab2d
@sxjscience sxjscience merged commit 9f9c135 into dmlc:master Jan 7, 2017

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
default Build finished.
Details
@sxjscience sxjscience deleted the sxjscience:topk_arange_rebase5 branch Jan 8, 2017
@rravu3 rravu3 pushed a commit to rravu3/mxnet that referenced this pull request Jan 21, 2017
@sxjscience sxjscience + Rahul Ravu [OP] Topk and arange + Update submodules (#4565)
* initial add topk arange

fix arange

Put back ones and zeros

fix

fix default ctx

* fix lint

* Update Submodules

* Update MShadow

* fix warning

* fix pylint

* style fix
cae3b10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment