[GitHub] [incubator-mxnet] liuzh91 commented on issue #17086: [MKLDNN] RNN Op gradient computation is broken

2019-12-26 Thread GitBox
liuzh91 commented on issue #17086: [MKLDNN] RNN Op gradient computation is 
broken
URL: 
https://github.com/apache/incubator-mxnet/issues/17086#issuecomment-569213451
 
 
   > Hi, @liuzh91 @szhengac. We have posted #17183 to fix the gradient 
explosion issue in RNN Backward. Thanks for reporting this issue again. And it 
would be greatly appreciated if you could give a test on this patch. Thanks.
   > 
   > BTW, we got the below training log:
   > 
   > ```
   > ❯ python word_language_model.py --log-interval=1
   > /path/to/mxnet/python/mxnet/optimizer/optimizer.py:167: UserWarning: 
WARNING: New optimizer gluonnlp.optimizer.lamb.LAMB is overriding existing 
optimizer mxnet.optimizer.optimizer.LAMB
   >   Optimizer.opt_registry[name].__name__))
   > Namespace(alpha=2, batch_size=80, beta=1, bptt=70, clip=0.25, dropout=0.4, 
dropout_e=0.1, dropout_h=0.2, dropout_i=0.65, emsize=400, epochs=750, 
eval_only=False, gpu=None, log_interval=1, lr=30, lr_update_factor=0.1, 
lr_update_interval=30, model='lstm', nhid=1150, nlayers=3, ntasgd=False, 
optimizer='sgd', save='model.params', test_mode=False, tied=False, wd=1.2e-06, 
weight_dropout=0.5)
   > Use AWDRNN
   > AWDRNN(
   >   (embedding): HybridSequential(
   > (0): Embedding(33278 -> 400, float32)
   > (1): Dropout(p = 0.65, axes=(0,))
   >   )
   >   (encoder): HybridSequential(
   > (0): LSTM(400 -> 1150, TNC)
   > (1): LSTM(1150 -> 1150, TNC)
   > (2): LSTM(1150 -> 1150, TNC)
   >   )
   >   (decoder): HybridSequential(
   > (0): Dense(None -> 33278, linear)
   >   )
   > )
   > [Epoch 0 Batch 1/372] current loss 20.50, ppl 796977445.38, throughput 
18.37 samples/s, lr 30.86
   > [Epoch 0 Batch 2/372] current loss 9.51, ppl 13511.50, throughput 39.56 
samples/s, lr 28.29
   > [Epoch 0 Batch 3/372] current loss 17.53, ppl 41003388.51, throughput 
40.65 samples/s, lr 27.43
   > [Epoch 0 Batch 4/372] current loss 9.45, ppl 12761.47, throughput 40.39 
samples/s, lr 27.43
   > [Epoch 0 Batch 5/372] current loss 14.34, ppl 1695623.66, throughput 35.59 
samples/s, lr 31.71
   > [Epoch 0 Batch 6/372] current loss 9.40, ppl 12113.46, throughput 35.10 
samples/s, lr 32.14
   > [Epoch 0 Batch 7/372] current loss 8.56, ppl 5232.00, throughput 37.62 
samples/s, lr 30.00
   > [Epoch 0 Batch 8/372] current loss 9.32, ppl 11163.67, throughput 42.00 
samples/s, lr 26.57
   > [Epoch 0 Batch 9/372] current loss 8.44, ppl 4642.37, throughput 61.95 
samples/s, lr 17.14
   > [Epoch 0 Batch 10/372] current loss 8.92, ppl 7494.76, throughput 41.39 
samples/s, lr 27.00
   > ```
   
   Thank you for the commit. We will double check whether the bug still 
persists.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] zixuanweeei commented on issue #17086: [MKLDNN] RNN Op gradient computation is broken

2019-12-26 Thread GitBox
zixuanweeei commented on issue #17086: [MKLDNN] RNN Op gradient computation is 
broken
URL: 
https://github.com/apache/incubator-mxnet/issues/17086#issuecomment-569213067
 
 
   Hi, @liuzh91 @szhengac. We have posted 
https://github.com/apache/incubator-mxnet/pull/17183 to fix the gradient 
explosion issue in RNN Backward. Thanks for reporting this issue again. And it 
would be greatly appreciated if you could give a test on this patch. Thanks.
   
   BTW, we got the below training log:
   ```
   ❯ python word_language_model.py --log-interval=1
   /path/to/mxnet/python/mxnet/optimizer/optimizer.py:167: UserWarning: 
WARNING: New optimizer gluonnlp.optimizer.lamb.LAMB is overriding existing 
optimizer mxnet.optimizer.optimizer.LAMB
 Optimizer.opt_registry[name].__name__))
   Namespace(alpha=2, batch_size=80, beta=1, bptt=70, clip=0.25, dropout=0.4, 
dropout_e=0.1, dropout_h=0.2, dropout_i=0.65, emsize=400, epochs=750, 
eval_only=False, gpu=None, log_interval=1, lr=30, lr_update_factor=0.1, 
lr_update_interval=30, model='lstm', nhid=1150, nlayers=3, ntasgd=False, 
optimizer='sgd', save='model.params', test_mode=False, tied=False, wd=1.2e-06, 
weight_dropout=0.5)
   Use AWDRNN
   AWDRNN(
 (embedding): HybridSequential(
   (0): Embedding(33278 -> 400, float32)
   (1): Dropout(p = 0.65, axes=(0,))
 )
 (encoder): HybridSequential(
   (0): LSTM(400 -> 1150, TNC)
   (1): LSTM(1150 -> 1150, TNC)
   (2): LSTM(1150 -> 1150, TNC)
 )
 (decoder): HybridSequential(
   (0): Dense(None -> 33278, linear)
 )
   )
   [Epoch 0 Batch 1/372] current loss 20.50, ppl 796977445.38, throughput 18.37 
samples/s, lr 30.86
   [Epoch 0 Batch 2/372] current loss 9.51, ppl 13511.50, throughput 39.56 
samples/s, lr 28.29
   [Epoch 0 Batch 3/372] current loss 17.53, ppl 41003388.51, throughput 40.65 
samples/s, lr 27.43
   [Epoch 0 Batch 4/372] current loss 9.45, ppl 12761.47, throughput 40.39 
samples/s, lr 27.43
   [Epoch 0 Batch 5/372] current loss 14.34, ppl 1695623.66, throughput 35.59 
samples/s, lr 31.71
   [Epoch 0 Batch 6/372] current loss 9.40, ppl 12113.46, throughput 35.10 
samples/s, lr 32.14
   [Epoch 0 Batch 7/372] current loss 8.56, ppl 5232.00, throughput 37.62 
samples/s, lr 30.00
   [Epoch 0 Batch 8/372] current loss 9.32, ppl 11163.67, throughput 42.00 
samples/s, lr 26.57
   [Epoch 0 Batch 9/372] current loss 8.44, ppl 4642.37, throughput 61.95 
samples/s, lr 17.14
   [Epoch 0 Batch 10/372] current loss 8.92, ppl 7494.76, throughput 41.39 
samples/s, lr 27.00
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] liuzh91 opened a new issue #17184: Weight tied cannot be used with weight sharing

2019-12-26 Thread GitBox
liuzh91 opened a new issue #17184: Weight tied cannot be used with weight 
sharing
URL: https://github.com/apache/incubator-mxnet/issues/17184
 
 
   ## Description
   We experience some weight initialization error when we use weight sharing 
and weight tied simultaneously. We share weights between `model` and 
`model_eval`. The code is shown below:
   
   ```python
   model = nlp.model.train.AWDRNN(args.model, len(vocab), args.emsize, 
args.nhid, args.nlayers,
  args.tied, args.dropout, args.weight_dropout,
  args.dropout_h, args.dropout_i, 
args.dropout_e)
   model_eval = nlp.model.AWDRNN(args.model, len(vocab), args.emsize, 
args.nhid, args.nlayers,
 args.tied, args.dropout, args.weight_dropout,
 args.dropout_h, args.dropout_i, args.dropout_e,
 params=model.collect_params())
   
   model.initialize(mx.init.Xavier(), ctx=context)
   
   model.hybridize(static_alloc=True)
   
   print(model)
   
   def check_initialized(net):
   params = net.collect_params()
   for param in params:
   try:
   params[param].list_ctx()
   except RuntimeError:
   return False
   return True
   
   print(check_initialized(model))
   print(check_initialized(model_eval))
   ```
   
   ### Log Message
   If `args.tied` is set `True`, we get the following log message:
   ```python
   True
   False
   ```
   If we turn off `args.tied`, the initialization works correctly.
   
   ### To Reproduce
   (If you developed your own code, please provide a short script that 
reproduces the error. For existing examples, please provide link.)
   The file can be found in 
(https://github.com/dmlc/gluon-nlp/blob/v0.8.x/scripts/language_model/word_language_model.py).
 To reproduce the above message, you may need to replace line 153 onward  with 
the above code snippet. Run the following command:
   
   ```
   python -m pdb word_language_model.py --tied --dropout_e=0
   ```
   You will encounter the above error.
   
   ## What have you tried to solve it?
   
   The parameter that not initialized properly is the parameter 
`awdrnn0_hybridsequential0_embedding0_bias`. It is the weight used in the 
decoder of AWDRNN.  After some investigation, we found it is the tied weights 
introducing this error:
   
   ```python
   if self._tie_weights:
output.add(nn.Dense(self._vocab_size, flatten=False,
params=self.embedding[0].params))
   ```
   
   I print some debug information which may be helpful here:
   ```
   (Pdb) 
model_eval.decoder[0]._params['awdrnn0_hybridsequential0_embedding0_bias'].list_ctx()
   *** RuntimeError: Parameter 'awdrnn0_hybridsequential0_embedding0_bias' has 
not been initialized
   ```
   
   ## Environment
   
   We recommend using our script for collecting the diagnositc information. Run 
the following command and paste the outputs below:
   ```
   curl --retry 10 -s 
https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | 
python
   
   # paste outputs here
   ```
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] zixuanweeei opened a new pull request #17183: [MKL-DNN][WIP] MKL-DNN RNN backward path enhancement

2019-12-26 Thread GitBox
zixuanweeei opened a new pull request #17183: [MKL-DNN][WIP] MKL-DNN RNN 
backward path enhancement
URL: https://github.com/apache/incubator-mxnet/pull/17183
 
 
   ## Description ##
   Mainly aims to fix the gradients' explosion reported by 
https://github.com/apache/incubator-mxnet/issues/17086. Other enhancements are 
also enabled, which are listed in the Changes section. 
   
   ## Checklist ##
   ### Changes ###
   * Flush memory before RNN backward primitive
   * Add gluon-rnn unit test for gradients check
   * Cache reorder
   * Re-write rnn supporting check
   * Update OpSignature.AddSign to avoid potential hash collision for 
rnn-packed memory
   
   ## Comments ##
   - Backward performance should have been improved to some degree as we cached 
the reorder primitives. A performance comparison will be posted later. Besides, 
this patch is supposed to have no impact on the Forward path.
   
   @ciyongch @TaoLv @pengzhao-intel 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on issue #15515: [MXNET-978] Higher Order Gradient Support `arcsin`, `arccos`.

2019-12-26 Thread GitBox
apeforest commented on issue #15515: [MXNET-978] Higher Order Gradient Support 
`arcsin`, `arccos`.
URL: https://github.com/apache/incubator-mxnet/pull/15515#issuecomment-569208830
 
 
   @kshitij12345 I have sent a slack invite to kshitijkalambar...@gmail.com. 
Please accept. Thanks!


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.

2019-12-26 Thread aaronmarkham
This is an automated email from the ASF dual-hosted git repository.

aaronmarkham pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 73c54cf  Bump the publish timestamp.
73c54cf is described below

commit 73c54cf5a581e1414c9a15ca3bf36eec238a32a2
Author: mxnet-ci 
AuthorDate: Fri Dec 27 06:42:45 2019 +

Bump the publish timestamp.
---
 date.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/date.txt b/date.txt
new file mode 100644
index 000..4158c95
--- /dev/null
+++ b/date.txt
@@ -0,0 +1 @@
+Fri Dec 27 06:42:45 UTC 2019



[GitHub] [incubator-mxnet] xidulu edited a comment on issue #17179: [Numpy] where does not support python scalar as the input

2019-12-26 Thread GitBox
xidulu edited a comment on issue #17179: [Numpy] where does not support python 
scalar as the input
URL: 
https://github.com/apache/incubator-mxnet/issues/17179#issuecomment-569201820
 
 
   I actually mentioned this problem in the PR, 
https://github.com/apache/incubator-mxnet/pull/16829#issuecomment-554489820 
The author suggested that you should wrap the scalar with`np.array`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] xidulu commented on issue #17179: [Numpy] where does not support python scalar as the input

2019-12-26 Thread GitBox
xidulu commented on issue #17179: [Numpy] where does not support python scalar 
as the input
URL: 
https://github.com/apache/incubator-mxnet/issues/17179#issuecomment-569201820
 
 
   I actually mentioned this problem in the PR, 
https://github.com/apache/incubator-mxnet/pull/16829#issuecomment-554489820 



This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361586715
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_softmax.cc
 ##
 @@ -86,6 +98,33 @@ void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs,
   stream->Submit();
 }
 
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs,
+  const OpContext &ctx,
+  const std::vector &in_data,
+  const std::vector& req,
+  const std::vector &out_data) {
+  if (req[0] == kNullOp) return;
+  CHECK_EQ(in_data.size(), 2U);
+  const SoftmaxParam& param = nnvm::get(attrs.parsed);
+  int axis = CheckAxis(param.axis, in_data[1].shape().ndim());
+  auto diff_mem = in_data[0].GetMKLDNNData();
+  auto data_mem = in_data[1].GetMKLDNNData();
+  auto fwd_pd = GetSoftmaxFwdPd(ctx.is_train, axis, *data_mem);
+  auto bwd_pd = GetSoftmaxBwdPd(*diff_mem, *data_mem, axis, fwd_pd);
+
+  auto out_mem = CreateMKLDNNMem(out_data[0], bwd_pd.diff_src_desc(), req[0]);
+  MKLDNNStream *stream = MKLDNNStream::Get();
+  mkldnn_args_map_t args = {
+{ MKLDNN_ARG_DST, *data_mem },
+{ MKLDNN_ARG_DIFF_DST, *diff_mem },
+{ MKLDNN_ARG_DIFF_SRC, *out_mem.second },
+  };
+
+  stream->RegisterPrimArgs(bwd_pd, args);
 
 Review comment:
   I will make it more clearly by adding  constructor before used.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361585996
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_softmax.cc
 ##
 @@ -86,6 +98,33 @@ void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs,
   stream->Submit();
 }
 
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs,
+  const OpContext &ctx,
+  const std::vector &in_data,
+  const std::vector& req,
+  const std::vector &out_data) {
+  if (req[0] == kNullOp) return;
+  CHECK_EQ(in_data.size(), 2U);
+  const SoftmaxParam& param = nnvm::get(attrs.parsed);
+  int axis = CheckAxis(param.axis, in_data[1].shape().ndim());
+  auto diff_mem = in_data[0].GetMKLDNNData();
+  auto data_mem = in_data[1].GetMKLDNNData();
+  auto fwd_pd = GetSoftmaxFwdPd(ctx.is_train, axis, *data_mem);
+  auto bwd_pd = GetSoftmaxBwdPd(*diff_mem, *data_mem, axis, fwd_pd);
+
+  auto out_mem = CreateMKLDNNMem(out_data[0], bwd_pd.diff_src_desc(), req[0]);
+  MKLDNNStream *stream = MKLDNNStream::Get();
+  mkldnn_args_map_t args = {
+{ MKLDNN_ARG_DST, *data_mem },
+{ MKLDNN_ARG_DIFF_DST, *diff_mem },
+{ MKLDNN_ARG_DIFF_SRC, *out_mem.second },
+  };
+
+  stream->RegisterPrimArgs(bwd_pd, args);
 
 Review comment:
   yes, you're right.
   Although it is a pd, it call implicit constructor
   inline primitive::primitive(const primitive_desc &pd) : primitive(pd.get()) 
{}
   to get a primitive 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (a6ed69e -> 1cfaf3c)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from a6ed69e  amax (#17176)
 add 1cfaf3c  [numpy]Add op delete (#17023)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/_op.py  |  63 +++-
 python/mxnet/numpy/multiarray.py   |  51 ++-
 python/mxnet/numpy_dispatch_protocol.py|   1 +
 python/mxnet/symbol/numpy/_symbol.py   |  41 ++-
 src/operator/numpy/np_delete_op-inl.h  | 347 +
 src/operator/numpy/np_delete_op.cc |  98 ++
 .../numpy/{np_memory_op.cu => np_delete_op.cu} |  17 +-
 .../python/unittest/test_numpy_interoperability.py |  22 ++
 tests/python/unittest/test_numpy_op.py |  75 +
 9 files changed, 704 insertions(+), 11 deletions(-)
 create mode 100644 src/operator/numpy/np_delete_op-inl.h
 create mode 100644 src/operator/numpy/np_delete_op.cc
 copy src/operator/numpy/{np_memory_op.cu => np_delete_op.cu} (75%)



[incubator-mxnet] branch master updated (a6ed69e -> 1cfaf3c)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from a6ed69e  amax (#17176)
 add 1cfaf3c  [numpy]Add op delete (#17023)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/_op.py  |  63 +++-
 python/mxnet/numpy/multiarray.py   |  51 ++-
 python/mxnet/numpy_dispatch_protocol.py|   1 +
 python/mxnet/symbol/numpy/_symbol.py   |  41 ++-
 src/operator/numpy/np_delete_op-inl.h  | 347 +
 src/operator/numpy/np_delete_op.cc |  98 ++
 .../numpy/{np_memory_op.cu => np_delete_op.cu} |  17 +-
 .../python/unittest/test_numpy_interoperability.py |  22 ++
 tests/python/unittest/test_numpy_op.py |  75 +
 9 files changed, 704 insertions(+), 11 deletions(-)
 create mode 100644 src/operator/numpy/np_delete_op-inl.h
 create mode 100644 src/operator/numpy/np_delete_op.cc
 copy src/operator/numpy/{np_memory_op.cu => np_delete_op.cu} (75%)



[GitHub] [incubator-mxnet] haojin2 merged pull request #17023: [numpy]Add op delete

2019-12-26 Thread GitBox
haojin2 merged pull request #17023: [numpy]Add op delete
URL: https://github.com/apache/incubator-mxnet/pull/17023
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (38388ff -> a6ed69e)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 38388ff  fix format (#17100)
 add a6ed69e  amax (#17176)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/_numpy_op_doc.py| 11 +--
 python/mxnet/numpy_dispatch_protocol.py  |  1 +
 src/operator/numpy/np_broadcast_reduce_op_value.cc   |  1 +
 tests/python/unittest/test_numpy_interoperability.py | 15 +++
 4 files changed, 26 insertions(+), 2 deletions(-)



[incubator-mxnet] branch master updated (38388ff -> a6ed69e)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 38388ff  fix format (#17100)
 add a6ed69e  amax (#17176)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/_numpy_op_doc.py| 11 +--
 python/mxnet/numpy_dispatch_protocol.py  |  1 +
 src/operator/numpy/np_broadcast_reduce_op_value.cc   |  1 +
 tests/python/unittest/test_numpy_interoperability.py | 15 +++
 4 files changed, 26 insertions(+), 2 deletions(-)



[incubator-mxnet] branch master updated (37197b6 -> 38388ff)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 37197b6  any/all (#17087)
 add 38388ff  fix format (#17100)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/linalg.py   |  50 +-
 python/mxnet/numpy/linalg.py   |  50 +-
 python/mxnet/numpy_dispatch_protocol.py|   1 +
 python/mxnet/symbol/numpy/linalg.py|  50 +-
 src/operator/numpy/linalg/np_tensorsolve-inl.h | 557 +
 src/operator/numpy/linalg/np_tensorsolve.cc| 145 ++
 .../linalg/{np_gesvd.cu => np_tensorsolve.cu}  |  15 +-
 .../python/unittest/test_numpy_interoperability.py |  61 +++
 tests/python/unittest/test_numpy_op.py | 154 ++
 9 files changed, 1072 insertions(+), 11 deletions(-)
 create mode 100644 src/operator/numpy/linalg/np_tensorsolve-inl.h
 create mode 100644 src/operator/numpy/linalg/np_tensorsolve.cc
 copy src/operator/numpy/linalg/{np_gesvd.cu => np_tensorsolve.cu} (72%)



[incubator-mxnet] branch master updated (37197b6 -> 38388ff)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 37197b6  any/all (#17087)
 add 38388ff  fix format (#17100)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/linalg.py   |  50 +-
 python/mxnet/numpy/linalg.py   |  50 +-
 python/mxnet/numpy_dispatch_protocol.py|   1 +
 python/mxnet/symbol/numpy/linalg.py|  50 +-
 src/operator/numpy/linalg/np_tensorsolve-inl.h | 557 +
 src/operator/numpy/linalg/np_tensorsolve.cc| 145 ++
 .../linalg/{np_gesvd.cu => np_tensorsolve.cu}  |  15 +-
 .../python/unittest/test_numpy_interoperability.py |  61 +++
 tests/python/unittest/test_numpy_op.py | 154 ++
 9 files changed, 1072 insertions(+), 11 deletions(-)
 create mode 100644 src/operator/numpy/linalg/np_tensorsolve-inl.h
 create mode 100644 src/operator/numpy/linalg/np_tensorsolve.cc
 copy src/operator/numpy/linalg/{np_gesvd.cu => np_tensorsolve.cu} (72%)



[GitHub] [incubator-mxnet] haojin2 merged pull request #17100: [Numpy] add op np.linalg.tensorsolve

2019-12-26 Thread GitBox
haojin2 merged pull request #17100: [Numpy] add op np.linalg.tensorsolve
URL: https://github.com/apache/incubator-mxnet/pull/17100
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] haojin2 merged pull request #17176: Op amax [Numpy]

2019-12-26 Thread GitBox
haojin2 merged pull request #17176: Op amax [Numpy]
URL: https://github.com/apache/incubator-mxnet/pull/17176
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (2ad3ce4 -> 37197b6)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 2ad3ce4  broadcast_axis optimization (#17091)
 add 37197b6  any/all (#17087)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/_numpy_op_doc.py  | 101 +
 python/mxnet/numpy_dispatch_protocol.py|   2 +
 src/operator/mshadow_op.h  |   8 ++
 src/operator/mxnet_op.h|  23 +
 src/operator/numpy/np_broadcast_reduce_op.h|  53 +++
 .../numpy/np_broadcast_reduce_op_boolean.cc|  85 +
 ..._index.cu => np_broadcast_reduce_op_boolean.cu} |  15 +--
 src/operator/operator_tune.cc  |   2 +
 src/operator/tensor/broadcast_reduce-inl.cuh   |  10 ++
 src/operator/tensor/broadcast_reduce-inl.h |  12 +++
 src/operator/tensor/broadcast_reduce_op.h  |  33 +++
 src/operator/tensor/matrix_op-inl.h|   2 +-
 .../python/unittest/test_numpy_interoperability.py |  28 ++
 tests/python/unittest/test_numpy_op.py |  78 
 14 files changed, 445 insertions(+), 7 deletions(-)
 create mode 100644 src/operator/numpy/np_broadcast_reduce_op_boolean.cc
 copy src/operator/numpy/{np_broadcast_reduce_op_index.cu => 
np_broadcast_reduce_op_boolean.cu} (75%)



[incubator-mxnet] branch master updated (2ad3ce4 -> 37197b6)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 2ad3ce4  broadcast_axis optimization (#17091)
 add 37197b6  any/all (#17087)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/_numpy_op_doc.py  | 101 +
 python/mxnet/numpy_dispatch_protocol.py|   2 +
 src/operator/mshadow_op.h  |   8 ++
 src/operator/mxnet_op.h|  23 +
 src/operator/numpy/np_broadcast_reduce_op.h|  53 +++
 .../numpy/np_broadcast_reduce_op_boolean.cc|  85 +
 ..._index.cu => np_broadcast_reduce_op_boolean.cu} |  15 +--
 src/operator/operator_tune.cc  |   2 +
 src/operator/tensor/broadcast_reduce-inl.cuh   |  10 ++
 src/operator/tensor/broadcast_reduce-inl.h |  12 +++
 src/operator/tensor/broadcast_reduce_op.h  |  33 +++
 src/operator/tensor/matrix_op-inl.h|   2 +-
 .../python/unittest/test_numpy_interoperability.py |  28 ++
 tests/python/unittest/test_numpy_op.py |  78 
 14 files changed, 445 insertions(+), 7 deletions(-)
 create mode 100644 src/operator/numpy/np_broadcast_reduce_op_boolean.cc
 copy src/operator/numpy/{np_broadcast_reduce_op_index.cu => 
np_broadcast_reduce_op_boolean.cu} (75%)



[GitHub] [incubator-mxnet] haojin2 merged pull request #17087: OP All/Any [Numpy]

2019-12-26 Thread GitBox
haojin2 merged pull request #17087: OP All/Any [Numpy]
URL: https://github.com/apache/incubator-mxnet/pull/17087
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TaoLv commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
TaoLv commented on a change in pull request #17170: add mkldnn softmax backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361568985
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_softmax.cc
 ##
 @@ -86,6 +98,33 @@ void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs,
   stream->Submit();
 }
 
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs,
+  const OpContext &ctx,
+  const std::vector &in_data,
+  const std::vector& req,
+  const std::vector &out_data) {
+  if (req[0] == kNullOp) return;
+  CHECK_EQ(in_data.size(), 2U);
+  const SoftmaxParam& param = nnvm::get(attrs.parsed);
+  int axis = CheckAxis(param.axis, in_data[1].shape().ndim());
+  auto diff_mem = in_data[0].GetMKLDNNData();
+  auto data_mem = in_data[1].GetMKLDNNData();
+  auto fwd_pd = GetSoftmaxFwdPd(ctx.is_train, axis, *data_mem);
+  auto bwd_pd = GetSoftmaxBwdPd(*diff_mem, *data_mem, axis, fwd_pd);
+
+  auto out_mem = CreateMKLDNNMem(out_data[0], bwd_pd.diff_src_desc(), req[0]);
+  MKLDNNStream *stream = MKLDNNStream::Get();
+  mkldnn_args_map_t args = {
+{ MKLDNN_ARG_DST, *data_mem },
+{ MKLDNN_ARG_DIFF_DST, *diff_mem },
+{ MKLDNN_ARG_DIFF_SRC, *out_mem.second },
+  };
+
+  stream->RegisterPrimArgs(bwd_pd, args);
 
 Review comment:
   I mean here you need give a primitive not a primitive descriptor. Please 
check the definition of RegisterPrimArgs.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361566549
 
 

 ##
 File path: src/operator/nn/softmax.cc
 ##
 @@ -54,13 +54,30 @@ static void SoftmaxComputeExCPU(const nnvm::NodeAttrs& 
attrs,
   inputs, req, outputs);
 }
 
+static void SoftmaxGradComputeExCPU(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // It seems MKLDNN softmax doesn't support training.
 
 Review comment:
   Will remove this out-dated comments


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361566529
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_softmax.cc
 ##
 @@ -86,6 +98,33 @@ void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs,
   stream->Submit();
 }
 
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs,
+  const OpContext &ctx,
 
 Review comment:
   Will change. Thanks


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361566500
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_ops-inl.h
 ##
 @@ -93,6 +93,10 @@ void MKLDNNLeakyReluBackward(const nnvm::NodeAttrs &attrs, 
const OpContext &ctx,
 void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs, const OpContext &ctx,
   const NDArray &in_data, const OpReqType &req,
   const NDArray &out_data);
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs, const OpContext &ctx,
+  const std::vector &in_data,
 
 Review comment:
   Will change. Thanks


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361566556
 
 

 ##
 File path: src/operator/nn/softmax.cc
 ##
 @@ -54,13 +54,30 @@ static void SoftmaxComputeExCPU(const nnvm::NodeAttrs& 
attrs,
   inputs, req, outputs);
 }
 
+static void SoftmaxGradComputeExCPU(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // It seems MKLDNN softmax doesn't support training.
+  const SoftmaxParam& param = nnvm::get(attrs.parsed);
+  if (SupportMKLDNNSoftmax(param, inputs[1], outputs[0])) {
+MKLDNN_OPCHECK_INIT(false, outputs.size(), inputs, outputs);
+MKLDNNRun(MKLDNNSoftmaxBackward, attrs, ctx, inputs, req, outputs);
+auto fn = SoftmaxGradCompute;
+MKLDNN_OPCHECK_RUN(fn, attrs, ctx, inputs, req, outputs);
+return;
+  }
+  FallBackCompute(SoftmaxGradCompute, attrs, ctx,
+  inputs, req, outputs);
+}
+
 inline static bool SoftmaxStorageType(const nnvm::NodeAttrs& attrs,
   const int dev_mask,
   DispatchMode* dispatch_mode,
   std::vector *in_attrs,
   std::vector *out_attrs) {
   const SoftmaxParam& param = nnvm::get(attrs.parsed);
-  CHECK_EQ(in_attrs->size(), (param.use_length.value()) ? 2U : 1U);
 
 Review comment:
   this check will result in backward check fail. 
   Will recover this check and add another function for backward.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] rongzha1 commented on a change in pull request #17170: add mkldnn softmax backward

2019-12-26 Thread GitBox
rongzha1 commented on a change in pull request #17170: add mkldnn softmax 
backward 
URL: https://github.com/apache/incubator-mxnet/pull/17170#discussion_r361566537
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_softmax.cc
 ##
 @@ -86,6 +98,33 @@ void MKLDNNSoftmaxForward(const nnvm::NodeAttrs& attrs,
   stream->Submit();
 }
 
+void MKLDNNSoftmaxBackward(const nnvm::NodeAttrs& attrs,
+  const OpContext &ctx,
+  const std::vector &in_data,
+  const std::vector& req,
+  const std::vector &out_data) {
+  if (req[0] == kNullOp) return;
+  CHECK_EQ(in_data.size(), 2U);
+  const SoftmaxParam& param = nnvm::get(attrs.parsed);
+  int axis = CheckAxis(param.axis, in_data[1].shape().ndim());
+  auto diff_mem = in_data[0].GetMKLDNNData();
+  auto data_mem = in_data[1].GetMKLDNNData();
+  auto fwd_pd = GetSoftmaxFwdPd(ctx.is_train, axis, *data_mem);
+  auto bwd_pd = GetSoftmaxBwdPd(*diff_mem, *data_mem, axis, fwd_pd);
+
+  auto out_mem = CreateMKLDNNMem(out_data[0], bwd_pd.diff_src_desc(), req[0]);
+  MKLDNNStream *stream = MKLDNNStream::Get();
+  mkldnn_args_map_t args = {
+{ MKLDNN_ARG_DST, *data_mem },
+{ MKLDNN_ARG_DIFF_DST, *diff_mem },
+{ MKLDNN_ARG_DIFF_SRC, *out_mem.second },
+  };
+
+  stream->RegisterPrimArgs(bwd_pd, args);
 
 Review comment:
   will change it to cache primitive pd.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (4fda46b -> 2ad3ce4)

2019-12-26 Thread sxjscience
This is an automated email from the ASF dual-hosted git repository.

sxjscience pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 4fda46b  fix py27 quantization (#17153)
 add 2ad3ce4  broadcast_axis optimization (#17091)

No new revisions were added by this update.

Summary of changes:
 src/operator/tensor/broadcast_reduce_op_value.cc | 37 +++-
 1 file changed, 36 insertions(+), 1 deletion(-)



[incubator-mxnet] branch master updated (4fda46b -> 2ad3ce4)

2019-12-26 Thread sxjscience
This is an automated email from the ASF dual-hosted git repository.

sxjscience pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 4fda46b  fix py27 quantization (#17153)
 add 2ad3ce4  broadcast_axis optimization (#17091)

No new revisions were added by this update.

Summary of changes:
 src/operator/tensor/broadcast_reduce_op_value.cc | 37 +++-
 1 file changed, 36 insertions(+), 1 deletion(-)



[GitHub] [incubator-mxnet] sxjscience merged pull request #17091: broadcast_axis optimization

2019-12-26 Thread GitBox
sxjscience merged pull request #17091: broadcast_axis optimization
URL: https://github.com/apache/incubator-mxnet/pull/17091
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] sxjscience commented on a change in pull request #17091: broadcast_axis optimization

2019-12-26 Thread GitBox
sxjscience commented on a change in pull request #17091: broadcast_axis 
optimization
URL: https://github.com/apache/incubator-mxnet/pull/17091#discussion_r361565125
 
 

 ##
 File path: src/operator/tensor/broadcast_reduce_op_value.cc
 ##
 @@ -32,6 +32,41 @@ DMLC_REGISTER_PARAMETER(BroadcastAxesParam);
 DMLC_REGISTER_PARAMETER(BroadcastToParam);
 DMLC_REGISTER_PARAMETER(BroadcastLikeParam);
 
+template
+void BroadcastAxisKer(DType* src,
+  DType* dst,
+  index_t outer,
+  index_t inner,
+  index_t size) {
+#pragma omp parallel for 
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
+  for (index_t i = 0; i < outer * size; i++) {
+const index_t m = i / size;
+const index_t n = i % size;
+void* offset = reinterpret_cast(dst + m * size * inner + n * inner);
+memcpy(offset, reinterpret_cast(src + m * inner), inner * sizeof 
(DType));
+  }
+}
+
+inline void BroadcastAxisComputeCPU(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  using namespace mshadow;
+  const BroadcastAxesParam& param = 
nnvm::get(attrs.parsed);
+  if (param.axis.ndim() == 1 && inputs[0].shape_[param.axis[0]] == 1 && req[0] 
== kWriteTo) {
 
 Review comment:
   Okay, then LGTM.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TaoLv commented on a change in pull request #17091: broadcast_axis optimization

2019-12-26 Thread GitBox
TaoLv commented on a change in pull request #17091: broadcast_axis optimization
URL: https://github.com/apache/incubator-mxnet/pull/17091#discussion_r361564897
 
 

 ##
 File path: src/operator/tensor/broadcast_reduce_op_value.cc
 ##
 @@ -32,6 +32,41 @@ DMLC_REGISTER_PARAMETER(BroadcastAxesParam);
 DMLC_REGISTER_PARAMETER(BroadcastToParam);
 DMLC_REGISTER_PARAMETER(BroadcastLikeParam);
 
+template
+void BroadcastAxisKer(DType* src,
+  DType* dst,
+  index_t outer,
+  index_t inner,
+  index_t size) {
+#pragma omp parallel for 
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
+  for (index_t i = 0; i < outer * size; i++) {
+const index_t m = i / size;
+const index_t n = i % size;
+void* offset = reinterpret_cast(dst + m * size * inner + n * inner);
+memcpy(offset, reinterpret_cast(src + m * inner), inner * sizeof 
(DType));
+  }
+}
+
+inline void BroadcastAxisComputeCPU(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  using namespace mshadow;
+  const BroadcastAxesParam& param = 
nnvm::get(attrs.parsed);
+  if (param.axis.ndim() == 1 && inputs[0].shape_[param.axis[0]] == 1 && req[0] 
== kWriteTo) {
 
 Review comment:
   It seems broadcast_axis doesn't support negative axis  even before this 
change. See 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/tensor/broadcast_reduce_op.h#L386.
   
   ```python
   import mxnet as mx
   
   a = mx.random.uniform(shape=(4, 5, 1))
   b = mx.nd.broadcast_axis(a, axis=-1, size=6)
   print(b)
   ```
   Will cause error:
   ```bash
   Traceback (most recent call last):
 File "test_bcast.py", line 4, in 
   b = mx.nd.broadcast_axis(a, axis=-1, size=6)
 File "", line 60, in broadcast_axis
 File 
"/home/lvtao/miniconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py",
 line 107, in _imperative_invoke
   ctypes.byref(out_stypes)))
 File 
"/home/lvtao/miniconda3/envs/mxnet/lib/python3.6/site-packages/mxnet/base.py", 
line 278, in check_call
   raise MXNetError(py_str(_LIB.MXGetLastError()))
   mxnet.base.MXNetError: [18:53:34] include/mxnet/./tuple.h:206: Check failed: 
i >= 0 && i < ndim(): index = -1 must be in range [0, 3)
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] ChaiBapchya commented on issue #17182: Seg Fault on dot product of sparse matrix with dense matrix

2019-12-26 Thread GitBox
ChaiBapchya commented on issue #17182: Seg Fault on dot product of sparse 
matrix with dense matrix
URL: 
https://github.com/apache/incubator-mxnet/issues/17182#issuecomment-569160727
 
 
   TODO: Add a check during sparse matrix creation to ensure index array size 
corresponds to the shape of array creation


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] ChaiBapchya commented on issue #17182: Seg Fault on dot product of sparse matrix with dense matrix

2019-12-26 Thread GitBox
ChaiBapchya commented on issue #17182: Seg Fault on dot product of sparse 
matrix with dense matrix
URL: 
https://github.com/apache/incubator-mxnet/issues/17182#issuecomment-569160581
 
 
   Oh okay. So another way of creating sparse matrix is first create 
scipy.sparse matrix and then convert it to mxnet.
   Scipy sparse matrix creation revealed the true error
   
   ```
   >>> c = spsp.csr.csr_matrix((np.array([2]),np.array([6]),np.array([0,1])), 
shape=shape)
   Traceback (most recent call last):
 File "", line 1, in 
 File 
"/home/ubuntu/anaconda3/envs/conda_sparse/lib/python3.6/site-packages/scipy/sparse/compressed.py",
 line 108, in __init__
   self.check_format(full_check=False)
 File 
"/home/ubuntu/anaconda3/envs/conda_sparse/lib/python3.6/site-packages/scipy/sparse/compressed.py",
 line 172, in check_format
   "".format(len(self.indptr), major_dim + 1))
   ValueError: index pointer size (2) should be (3)
   ```
   
   So the error handling / messaging can be done better on MXNet side.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569157786
 
 
   > @apeforest This benchmark script is from the EIA benchmark that we are 
using for inference tests. So it makes a call to check whether and EIA context 
is available, otherwise it will use mx.cpu() context.
   > 
   > @wuxun-zhang yeah I didn't see any regression! I'm looking closer at how 
we are timing it in the script. I'm a little confused because when you ran it, 
you're not getting any regression in the numbers, but when I run it, it looks 
like I have some regression.
   > 
   > Also, is there any difference between using `load_imagenet_gluon` vs 
`load_imagenet_module`?
   
   Yes. `load_imagenet_gluon` will use gluon hybridized model while 
`load_imagenet_module` will use symbolic model. If you want, you can also use 
`load_imagenet_module` to re-collect the latency of resnext50 with different 
mxnet-mkl versions. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] ChaiBapchya opened a new issue #17182: Seg Fault on dot product of sparse matrix with dense matrix

2019-12-26 Thread GitBox
ChaiBapchya opened a new issue #17182: Seg Fault on dot product of sparse 
matrix with dense matrix
URL: https://github.com/apache/incubator-mxnet/issues/17182
 
 
   ## Description
   Seg Fault on master, 1.5.1
   
   ### Error Message
   ```
   Segmentation fault: 11
   
   Stack trace:
 [bt] (0) 
/home/ubuntu/anaconda3/envs/mxnet_pip_install/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2b64150)
 [0x7fadfffb3150]
 [bt] (1) /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7fae14b354b0]
 [bt] (2) 
/home/ubuntu/anaconda3/envs/mxnet_pip_install/lib/python3.6/site-packages/mxnet/libmxnet.so(+0xf509a0)
 [0x7fadfe39f9a0]
 [bt] (3) 
/home/ubuntu/anaconda3/envs/mxnet_pip_install/bin/../lib/libgomp.so.1(+0x146d5) 
[0x7fae110456d5]
 [bt] (4) /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba) [0x7fae14ed16ba]
 [bt] (5) /lib/x86_64-linux-gnu/libc.so.6(clone+0x6d) [0x7fae14c0741d]
   ```
   ## To Reproduce
   ```
   import mxnet as mx
   shape = (2,10)
   from mxnet import nd
   sp_mat1 = nd.sparse.csr_matrix(([2],[6],[0,1]),shape=shape)
   mat2 = nd.ones((10,2))
   out = nd.dot(sp_mat1, mat2)
   ```
   
   ### Steps to reproduce
   
   1. pip install mxnet
   2. python shell
   
   ## What have you tried to solve it?
   
   1. Use gdb to find backtrace
   2.
   
   ## Environment
   
   We recommend using our script for collecting the diagnositc information. Run 
the following command and paste the outputs below:
   ```
   curl --retry 10 -s 
https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | 
python
   
   # paste outputs here
   ```
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (8a14a6a -> 4fda46b)

2019-12-26 Thread patriczhao
This is an automated email from the ASF dual-hosted git repository.

patriczhao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 8a14a6a  [MKL-DNN] Enhance Quantization Method (#17161)
 add 4fda46b  fix py27 quantization (#17153)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/contrib/quantization.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)



[GitHub] [incubator-mxnet] pengzhao-intel merged pull request #17161: [MKL-DNN] Enhance Quantization Method

2019-12-26 Thread GitBox
pengzhao-intel merged pull request #17161: [MKL-DNN] Enhance Quantization Method
URL: https://github.com/apache/incubator-mxnet/pull/17161
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (dfa3d07 -> 8a14a6a)

2019-12-26 Thread patriczhao
This is an automated email from the ASF dual-hosted git repository.

patriczhao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from dfa3d07  Further optimization for NCF model (#17148)
 add 8a14a6a  [MKL-DNN] Enhance Quantization Method (#17161)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/contrib/quantization.py | 55 +---
 1 file changed, 45 insertions(+), 10 deletions(-)



[GitHub] [incubator-mxnet] pengzhao-intel merged pull request #17153: fix py27 quantization

2019-12-26 Thread GitBox
pengzhao-intel merged pull request #17153: fix py27 quantization
URL: https://github.com/apache/incubator-mxnet/pull/17153
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.

2019-12-26 Thread aaronmarkham
This is an automated email from the ASF dual-hosted git repository.

aaronmarkham pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 4ee12b2  Bump the publish timestamp.
4ee12b2 is described below

commit 4ee12b28e301bfe360f32459bd591da73e1a4c32
Author: mxnet-ci 
AuthorDate: Fri Dec 27 00:42:38 2019 +

Bump the publish timestamp.
---
 date.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/date.txt b/date.txt
new file mode 100644
index 000..62cecbc
--- /dev/null
+++ b/date.txt
@@ -0,0 +1 @@
+Fri Dec 27 00:42:38 UTC 2019



[incubator-mxnet] branch master updated (cf81887 -> dfa3d07)

2019-12-26 Thread patriczhao
This is an automated email from the ASF dual-hosted git repository.

patriczhao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from cf81887  Quantized Elemwise Mul Operator (#17147)
 add dfa3d07  Further optimization for NCF model (#17148)

No new revisions were added by this update.

Summary of changes:
 example/neural_collaborative_filtering/README.md   | 36 ++
 .../benchmark.sh}  | 65 -
 example/neural_collaborative_filtering/convert.py  |  2 +-
 .../neural_collaborative_filtering/core/model.py   | 60 +++-
 .../model_optimizer.py | 81 ++
 example/neural_collaborative_filtering/ncf.py  | 24 +++
 example/neural_collaborative_filtering/train.py|  2 +-
 7 files changed, 193 insertions(+), 77 deletions(-)
 copy example/{quantization/launch_inference_mkldnn.sh => 
neural_collaborative_filtering/benchmark.sh} (62%)
 create mode 100644 example/neural_collaborative_filtering/model_optimizer.py



[incubator-mxnet] branch master updated (cf81887 -> dfa3d07)

2019-12-26 Thread patriczhao
This is an automated email from the ASF dual-hosted git repository.

patriczhao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from cf81887  Quantized Elemwise Mul Operator (#17147)
 add dfa3d07  Further optimization for NCF model (#17148)

No new revisions were added by this update.

Summary of changes:
 example/neural_collaborative_filtering/README.md   | 36 ++
 .../benchmark.sh}  | 65 -
 example/neural_collaborative_filtering/convert.py  |  2 +-
 .../neural_collaborative_filtering/core/model.py   | 60 +++-
 .../model_optimizer.py | 81 ++
 example/neural_collaborative_filtering/ncf.py  | 24 +++
 example/neural_collaborative_filtering/train.py|  2 +-
 7 files changed, 193 insertions(+), 77 deletions(-)
 copy example/{quantization/launch_inference_mkldnn.sh => 
neural_collaborative_filtering/benchmark.sh} (62%)
 create mode 100644 example/neural_collaborative_filtering/model_optimizer.py



[GitHub] [incubator-mxnet] pengzhao-intel merged pull request #17148: Further optimization for NCF model

2019-12-26 Thread GitBox
pengzhao-intel merged pull request #17148: Further optimization for NCF model
URL: https://github.com/apache/incubator-mxnet/pull/17148
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
apeforest commented on issue #17159: Performance regression from 1.4.1 to 1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569155617
 
 
   @wuxun-zhang Based on your earlier performance result, it seems we still see 
inference runtime increased from Avg: 14.64 in mxnet-1.4 to Avg: 
16.486327974449974 in mxnet-1.5. Maybe they are not related to MKLDNN 
operators. 
   
   @jonatan1626 Could you please continue to rootcause the commits that caused 
the performance regression between 1.4 and 1.5?
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] jonatan1626 edited a comment on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
jonatan1626 edited a comment on issue #17159: Performance regression from 1.4.1 
to 1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569151743
 
 
   @apeforest This benchmark script is from the EIA benchmark that we are using 
for inference tests. So it makes a call to check whether and EIA context is 
available, otherwise it will use mx.cpu() context.
   
   @wuxun-zhang yeah I didn't see any regression! I'm looking closer at how we 
are timing it in the script. I'm a little confused because when you ran it, 
you're not getting any regression in the numbers, but when I run it, it looks 
like I have some regression. 
   
   Also, is there any difference between using `load_imagenet_gluon` vs 
`load_imagenet_module`?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569151743
 
 
   @apeforest This benchmark script is from the EIA benchmark that we are using 
for inference tests. So it makes a call to check whether and EIA context is 
available, otherwise it will use mx.cpu() context.
   
   @wuxun-zhang yeah I didn't see any regression! I'm looking closer at how we 
are timing it in the script. I'm a little confused because when you ran it, 
you're not getting any regression in the numbers, but when I run it, it looks 
like I have some regression.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569151429
 
 
   @apeforest Look at the code 
[here](https://github.com/jonatan1626/mxnet_performance/blob/master/perf_script/misc.py#L44),
 if I understood correctly, this script just use `try...except...` to determine 
the running context. `ctx = mx.eia()` fails with throwing an exception.
   
   @jonatan1626 Glad it works. Looks that the time consuming of `conv` and `fc` 
accounts for most of time(>90%). From the above profiling results, we didn't 
see any obvious performance drop for each operator, right? 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest opened a new issue #17181: Fail to build mxnet from source

2019-12-26 Thread GitBox
apeforest opened a new issue #17181: Fail to build mxnet from source
URL: https://github.com/apache/incubator-mxnet/issues/17181
 
 
   ## Description
   Following the steps at https://mxnet.apache.org/get_started/ubuntu_setup
   I got the following error:
   
   
   ### Error Message
   ```
   OSError: /usr/lib/liblapack.so.3: undefined symbol: gotoblas
   ```
   
   ## To Reproduce
   ```
   rm -rf build
   mkdir -p build && cd build
   cmake -GNinja \
   -DUSE_CUDA=OFF \
   -DUSE_MKL_IF_AVAILABLE=ON \
   -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \
   -DCMAKE_C_COMPILER_LAUNCHER=ccache \
   -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
   -DCMAKE_BUILD_TYPE=Release \
   ..
   ninja
   ```
   
   
   ## Environment
   
   We recommend using our script for collecting the diagnositc information. Run 
the following command and paste the outputs below:
   ```
   --Python Info--
   Version  : 3.6.6
   Compiler : GCC 7.2.0
   Build: ('default', 'Jun 28 2018 17:14:51')
   Arch : ('64bit', '')
   Pip Info---
   Version  : 19.3.1
   Directory: 
/home/ubuntu/.virtualenvs/mxnet/lib/python3.6/site-packages/pip
   --MXNet Info---
   Hashtag not found. Not installed from pre-built package.
   --System Info--
   Platform : Linux-4.4.0-1094-aws-x86_64-with-debian-stretch-sid
   system   : Linux
   node : ip-172-31-15-220
   release  : 4.4.0-1094-aws
   version  : #105-Ubuntu SMP Mon Sep 16 13:08:01 UTC 2019
   --Hardware Info--
   machine  : x86_64
   processor: x86_64
   Architecture:  x86_64
   CPU op-mode(s):32-bit, 64-bit
   Byte Order:Little Endian
   CPU(s):32
   On-line CPU(s) list:   0-31
   Thread(s) per core:2
   Core(s) per socket:16
   Socket(s): 1
   NUMA node(s):  1
   Vendor ID: GenuineIntel
   CPU family:6
   Model: 79
   Model name:Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
   Stepping:  1
   CPU MHz:   2699.984
   CPU max MHz:   3000.
   CPU min MHz:   1200.
   BogoMIPS:  4600.09
   Hypervisor vendor: Xen
   Virtualization type:   full
   L1d cache: 32K
   L1i cache: 32K
   L2 cache:  256K
   L3 cache:  46080K
   NUMA node0 CPU(s): 0-31
   Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm 
constant_tsc rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmulqdq ssse3 
fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave 
avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti 
fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx xsaveopt
   --Network Test--
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0131 
sec, LOAD: 0.4585 sec.
   Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0005 
sec, LOAD: 0.4164 sec.
   Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.2340 sec, LOAD: 
0.3821 sec.
   Timing for D2L: http://d2l.ai, DNS: 0.1774 sec, LOAD: 0.1042 sec.
   Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0059 sec, LOAD: 0.2229 sec.
   Timing for FashionMNIST: 
https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, 
DNS: 0.0982 sec, LOAD: 0.1264 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0173 sec, LOAD: 
0.3984 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0106 sec, 
LOAD: 0.0637 sec.
   ```
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
apeforest commented on issue #17159: Performance regression from 1.4.1 to 1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569140957
 
 
   > EIA context not available, trying GPU...
   
   Why is this line ever printed at all? Apache mxnet should have no knowledge 
of EIA context.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] tqchen commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative Op Invocation Overhead

2019-12-26 Thread GitBox
tqchen commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative 
Op Invocation Overhead
URL: 
https://github.com/apache/incubator-mxnet/issues/17097#issuecomment-569139957
 
 
   @larroy indeed every solution has trade-offs, and these tradeoffs are 
discussed in the above posts when we compare solutions, and they are backed by 
benchmarks :) it would be great if you can also suggest potential tradeoffs 
here.
   
   When you expose an API from typed language(c++) to a dynamic 
language(python), you have to type erase it, given that the python functions 
don't have the type, and you have to pass the information along.  
   
   The only difference is where you do the type checking(that the python type 
corresponds to the right c++ type), and translation(translating to the c++ 
type).
   
   For example, in the case of pybind, the erasure is done implicitly when you 
call the python function, then checking and translation happens when you call 
into the c++ function.
   
   In the case of creating a C API for each feature and wrap things in the 
python side, the type checking is done in the python side, and translation as 
well.
   
   In the case of tvm ffi, the type translation is done in the python/cython 
side,  while the type checking is done in the c++. 
   
   To dive deeper into the tradeoffs for PackedFunc calling convention. The 
convention erases the type by having the type code stored into the arguments. 
This brings additional cost of passing arguments into heap, as opposed to 
registers. So they might not be designed for inline functions that needs to 
happen at the order of 1e-9s, however, for API functions that needs to run 
around 1e-7 or even 1e-8 level, this convention is pretty good.
   
   In terms of the calling cost, it really depends on whether the caller and 
callee are strongly typed.
   - If caller is strongly typed, then assigning type code is O(1)
   - If caller is a dynamic type(like python) then we need to have a dispatcher 
to dispatch and select the right type code
   - If callee is strongly typed, then the cost of checking is O(1) by just 
check the code to be the correct one 
   - If the callee is dynamic type, then a dispatching need to happen, which 
have another level of hashtable lookup O(1)
   
   As we can see, the only place where dispatching is necessary is the dynamic 
type handling case. Even in these cases, if there is a strong need of 
specialization, we can directly force the type by running checking on the 
caller, and pass in the right type code (the engineering burden is the same as 
wrapping the C API). However, the benchmark suggests that the dynamic 
dispatching cost is reasonable, and satisfies the API speed.
   
   Coming back to the tradeoff, the main tradeoff here is the engineering 
burden to keep an hourglass design(with fixed set of API) vs efficiency. While 
my post did not suggest that TVM's ffi is a silver bullet, it does works pretty 
well for our use cases. hope it helps
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] sxjscience commented on issue #16167: [RFC] Apache MXNet 2.0 Roadmap

2019-12-26 Thread GitBox
sxjscience commented on issue #16167: [RFC] Apache MXNet 2.0 Roadmap
URL: 
https://github.com/apache/incubator-mxnet/issues/16167#issuecomment-569139977
 
 
   Should we create a new branch for 2.0? I think we are also planing for 1.7.0 
https://github.com/apache/incubator-mxnet/issues/16864


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on issue #16864: [Discussion] 1.7.0 Roadmap

2019-12-26 Thread GitBox
apeforest commented on issue #16864: [Discussion] 1.7.0 Roadmap
URL: 
https://github.com/apache/incubator-mxnet/issues/16864#issuecomment-569136246
 
 
   A simple script to build from source using cmake: 
https://github.com/apache/incubator-mxnet/issues/17180


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest opened a new issue #17180: Need a better build script for CMake

2019-12-26 Thread GitBox
apeforest opened a new issue #17180: Need a better build script for CMake
URL: https://github.com/apache/incubator-mxnet/issues/17180
 
 
   ## Description
   The current instruction for users to build from source using Cmake is not 
very user-friendly. Users have to remember each flag whenever they build mxnet.
   
   It will be nice to have a simple setup.py and users only need to run the 
following as Pytorch:
   ```
   python setup.py install
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] larroy commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative Op Invocation Overhead

2019-12-26 Thread GitBox
larroy commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative 
Op Invocation Overhead
URL: 
https://github.com/apache/incubator-mxnet/issues/17097#issuecomment-569135990
 
 
   Pybind is nice, I used Boost python many years ago, which I think is based
   on. The problem with this is the hourglass C bindings, you have to go from
   Python to C++ / Pybind, down to C and to the engine, this seems like a lot
   of boilerplate.
   
   On Mon, Dec 16, 2019 at 10:02 PM reminisce  wrote:
   
   > MXNet imperative operator invocation overhead is as large as 30-60us,
   > which is significant compared to the official NumPy operators with ~600ns
   > overhead. This has negatively impacted the performance of applying MXNet to
   > the models where many operators' kernel runtime duration is short,
   > especially in the area of classic machine learning. We plan to address the
   > problem in two steps:
   >
   >1.
   >
   >Short term: Use pybind11 to replace Python op API and ctypes/c api.
   >Preliminary experiments show that the pure Python-C++ turnaround time by
   >using Pybind is between 400-600ns, while the current Python op API using
   >ctypes/c api costs more than 10us. We believe with the correct
   >implementation, we can reduce the op invocation overhead to 2us 
including
   >the time on FFI and engine.
   >2.
   >
   >Long term: Adopt Python's C extension interface. NumPy did this by
   >developing its own C API. This provides considerably less overhead 
compared
   >to other solutions. However, it would cost much more engineering 
efforts by
   >integrating this with our existing operator workflow in C++.
   >
   > @hzfan  @hgt312 
   >
   > —
   > You are receiving this because you are subscribed to this thread.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   >
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] sxjscience opened a new issue #17179: [Numpy] where does not support python scalar as the input

2019-12-26 Thread GitBox
sxjscience opened a new issue #17179: [Numpy] where does not support python 
scalar as the input
URL: https://github.com/apache/incubator-mxnet/issues/17179
 
 
   ```python
   import mxnet as mx
   mx.npx.set_np()
   a = mx.np.sym.var('a')
   a = mx.sym.var('a').as_np_ndarray()
   mx.sym.np.where(a, a, 0)
   ```
   
   Error message:
   ```
   ---
   AssertionErrorTraceback (most recent call last)
in 
   > 1 mx.sym.np.where(a, a, 0)
   
   ~/mxnet/python/mxnet/symbol/numpy/_symbol.py in where(condition, x, y)
  5501 
  5502 """
   -> 5503 return _npi.where(condition, x, y, out=None)
  5504 
  5505 
   
   ~/mxnet/python/mxnet/symbol/register.py in where(condition, x, y, name, 
attr, out, **kwargs)
   
   AssertionError: Argument y must be Symbol instances, but got 0
   ```
   
   Also, the imperative case:
   ```python
   import mxnet as mx
   mx.npx.set_np()
   mx.np.where(mx.np.ones((10, )), mx.np.ones((10, )), 0)
   ```
   
   Error message:
   ```
   AssertionErrorTraceback (most recent call last)
in 
   > 1 mx.np.where(mx.np.ones((10, )), mx.np.ones((10, )), 0)
   
   ~/mxnet/python/mxnet/numpy/multiarray.py in where(condition, x, y)
  7996[ 0.,  3., -1.]])
  7997 """
   -> 7998 return _mx_nd_np.where(condition, x, y)
  7999 
  8000 
   
   ~/mxnet/python/mxnet/ndarray/numpy/_op.py in where(condition, x, y)
  6035 return nonzero(condition)
  6036 else:
   -> 6037 return _npi.where(condition, x, y, out=None)
  6038 
  6039 
   
   ~/mxnet/python/mxnet/ndarray/register.py in where(condition, x, y, out, 
name, **kwargs)
   
   AssertionError: Argument y must have NDArray type, but got 0
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] larroy commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative Op Invocation Overhead

2019-12-26 Thread GitBox
larroy commented on issue #17097: [RFC][mxnet 2.0][item 10.1] MXNet Imperative 
Op Invocation Overhead
URL: 
https://github.com/apache/incubator-mxnet/issues/17097#issuecomment-569135511
 
 
   What's the point of having an API if you type erase it? Then you might as
   well have a single function API with a type erased callback name to select
   the function to call. In the end you move the burden away from the API to
   the callers and inside the API to the dispatchers. For going this route of
   uber-clever template tricks to generate code, I think it's better to just
   put in place proper code generation for maintainability. Could you provide
   a bit more details about tradeoffs? Everything has tradeoffs, I don't
   believe any solution which is sold as a panacea, there's no silver bullet.
   
   On Thu, Dec 19, 2019 at 10:21 AM Tianqi Chen 
   wrote:
   
   > I have another candidate that would highly recommend: adopt TVM's FFI
   > convention.
   >
   > The historical problem of MXNet FFI was the blowing amount of the C API
   > bindings as we add new features. This creates a huge amount of maintenance
   > burden.
   >
   > The real problem was not really about which FFI system to adopt(cython and
   > pybind are fine in that end, except for the cost of compilation), but more
   > of the cost to maintain the FFI. MXNet used to have a fast cython binding,
   > but that was abandoned because we keep add new APIs we cannot keep up both
   > ctypes and cython.
   >
   > When developing TVM we learnt from the lesson and restrict the API to a
   > limited set of runtime APIs that does not change, and have a stable cython,
   > ctypes binding for them. The runtime support a type-erased
   > function(PackedFunc), which can be efficiently called from any of the
   > frontend language, and all the APIs are exposed through the PackedFunc. On
   > the python side an additional wrapping is created for better documentation
   > and call into the PackedFunc. See more in
   > https://docs.tvm.ai/dev/runtime.html The system works great for over a
   > few years now.
   >
   > Of course I understand there has been legacy issues in MXNet that is why I
   > did not bring this proposal up. But given this is a proposal for 2.0, I
   > would encourage everyone to give a serious thought about this possibility.
   >
   > —
   > You are receiving this because you are subscribed to this thread.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or unsubscribe
   > 

   > .
   >
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] djaym7 closed issue #17178: Delete This

2019-12-26 Thread GitBox
djaym7 closed issue #17178: Delete This
URL: https://github.com/apache/incubator-mxnet/issues/17178
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] larroy commented on issue #17006: [RFC] Custom Operator Part 2

2019-12-26 Thread GitBox
larroy commented on issue #17006: [RFC] Custom Operator Part 2
URL: 
https://github.com/apache/incubator-mxnet/issues/17006#issuecomment-569131388
 
 
   @wkcn could you explain your suggestion? calling gemm back into the 
framework which gets dispatched to GPU or CPU?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] djaym7 opened a new issue #17178: MixConv - Efficient Gluon implementation

2019-12-26 Thread GitBox
djaym7 opened a new issue #17178: MixConv - Efficient Gluon implementation
URL: https://github.com/apache/incubator-mxnet/issues/17178
 
 
   ## Description
   https://arxiv.org/pdf/1907.09595v3.pdf
   Title says it all.
   ## References
   https://arxiv.org/pdf/1907.09595v3.pdf


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] sxjscience commented on a change in pull request #17091: broadcast_axis optimization

2019-12-26 Thread GitBox
sxjscience commented on a change in pull request #17091: broadcast_axis 
optimization
URL: https://github.com/apache/incubator-mxnet/pull/17091#discussion_r361524509
 
 

 ##
 File path: src/operator/tensor/broadcast_reduce_op_value.cc
 ##
 @@ -32,6 +32,41 @@ DMLC_REGISTER_PARAMETER(BroadcastAxesParam);
 DMLC_REGISTER_PARAMETER(BroadcastToParam);
 DMLC_REGISTER_PARAMETER(BroadcastLikeParam);
 
+template
+void BroadcastAxisKer(DType* src,
+  DType* dst,
+  index_t outer,
+  index_t inner,
+  index_t size) {
+#pragma omp parallel for 
num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
+  for (index_t i = 0; i < outer * size; i++) {
+const index_t m = i / size;
+const index_t n = i % size;
+void* offset = reinterpret_cast(dst + m * size * inner + n * inner);
+memcpy(offset, reinterpret_cast(src + m * inner), inner * sizeof 
(DType));
+  }
+}
+
+inline void BroadcastAxisComputeCPU(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  using namespace mshadow;
+  const BroadcastAxesParam& param = 
nnvm::get(attrs.parsed);
+  if (param.axis.ndim() == 1 && inputs[0].shape_[param.axis[0]] == 1 && req[0] 
== kWriteTo) {
 
 Review comment:
   We should deal with negative value in `param.axis`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on a change in pull request #16735: Use single-bit for mask in dropout operator

2019-12-26 Thread GitBox
apeforest commented on a change in pull request #16735: Use single-bit for mask 
in dropout operator
URL: https://github.com/apache/incubator-mxnet/pull/16735#discussion_r361522451
 
 

 ##
 File path: src/operator/nn/dropout-inl.h
 ##
 @@ -187,28 +188,98 @@ class DropoutOp {
 const index_t N,
 const index_t step,
 DType *dropout_out,
-DType *mask_out,
+uint8_t *mask_out,
 const DType *input_data,
 const real_t pkeep) {
+  CHECK_EQ(step & 7, 0);
   RNG_KERNEL_LOOP(xpu, DType, id, gen, N, step, {
 const real_t rand_num = static_cast(genImpl.uniform());
-mask_out[i] = mshadow_op::threshold_eq::Map(rand_num, pkeep) * 
(1.0f / pkeep);
-dropout_out[i] = input_data[i] * mask_out[i];
-  });
+// mask_out is set per bit position
+// therefore bitwise shift need to be performed here
+auto mask_idx = i / 8;
+auto mask_offset = i % 8;
+bool mask_val = mshadow_op::threshold_eq::Map(rand_num, pkeep);
+if (mask_val) {
+  // set bit
+  mask_out[mask_idx] |= 1U << mask_offset;
+} else {
+  // clear bit
+  mask_out[mask_idx] &= ~(1U << mask_offset);
+}
+dropout_out[i] = mask_val * input_data[i] * (1.0f / pkeep);
+  })
+}
+  };
+
+  struct DropoutBackwardKernel {
+MSHADOW_XINLINE static void Map(index_t i,
+OpReqType req,
+DType *igrad,
+DType *ograd,
+const uint8_t *mask,
+const real_t pkeep) {
+  auto mask_idx = i / 8;
+  uint8_t mask_offset = i % 8;
+  bool mask_val = (mask[mask_idx] >> mask_offset) & 1U;
+  KERNEL_ASSIGN(igrad[i], req, mask_val * ograd[i] * (1 / pkeep));
 
 Review comment:
   Thanks for explanation. Updated.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] apeforest commented on a change in pull request #16735: Use single-bit for mask in dropout operator

2019-12-26 Thread GitBox
apeforest commented on a change in pull request #16735: Use single-bit for mask 
in dropout operator
URL: https://github.com/apache/incubator-mxnet/pull/16735#discussion_r361515351
 
 

 ##
 File path: src/operator/nn/dropout-inl.h
 ##
 @@ -187,28 +188,101 @@ class DropoutOp {
 const index_t N,
 const index_t step,
 DType *dropout_out,
-DType *mask_out,
+uint8_t *mask_out,
 const DType *input_data,
 const real_t pkeep) {
   RNG_KERNEL_LOOP(xpu, DType, id, gen, N, step, {
 const real_t rand_num = static_cast(genImpl.uniform());
-mask_out[i] = mshadow_op::threshold_eq::Map(rand_num, pkeep) * 
(1.0f / pkeep);
-dropout_out[i] = input_data[i] * mask_out[i];
-  });
+// mask_out is set per bit position
+// therefore bitwise shift need to be performed here
+auto maskIdx = i / 8;
+auto maskOffset = i % 8;
+bool maskVal = mshadow_op::threshold_eq::Map(rand_num, pkeep);
+if (maskVal) {
+  // set bit
+  mask_out[maskIdx] |= 1U << maskOffset;
 
 Review comment:
   Fair point. I will refactor this piece of code.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.

2019-12-26 Thread aaronmarkham
This is an automated email from the ASF dual-hosted git repository.

aaronmarkham pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new eb7bf8c  Bump the publish timestamp.
eb7bf8c is described below

commit eb7bf8cdf05575bf7c439c1605f8a61adf9d8417
Author: mxnet-ci 
AuthorDate: Thu Dec 26 18:43:07 2019 +

Bump the publish timestamp.
---
 date.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/date.txt b/date.txt
new file mode 100644
index 000..19272ec
--- /dev/null
+++ b/date.txt
@@ -0,0 +1 @@
+Thu Dec 26 18:43:07 UTC 2019



[GitHub] [incubator-mxnet] jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569095188
 
 
   Thanks @wuxun-zhang!
   
   Here are the results of my run (I switched the iterations to 1):
   
   **mxnet-mkl==1.4.1**
   ```
   operator
   =
   Name  Total CountTime (ms)Min Time (ms)  
  Max Time (ms)Avg Time (ms)
     -----  
  --
   SoftmaxOutput   41150.4480   0.0200  
15.1680   0.0288
   DeleteVariable 10 398.5110   0.  
 0.0290   0.0040
   Reorder12 284.6760   0.0010  
 0.2120   0.0024
   WaitForVar  4 394.4030   0.0050  
 0.0280   0.0099
   Pooling 83309.8770   0.0180  
19.7900   0.0414
   _sg_mkldnn_conv   212  425492.1875   0.0320  
32.0680   0.2007
   BatchNorm   44496.3232   0.0350  
31.7840   0.1124
   FullyConnected  4   11512.5957   0.2460  
27.1810   0.2878
   Flatten 46089.9600   0.1300  
12.0980   0.1522
   CopyCPU2CPU 600027034.2251   0.0890  
 0.1550   0.1172
   ```
   
   **mxnet-mkl==1.5.1**
   ```
   operator
   =
   Name  Total CountTime (ms)Min Time (ms)  
  Max Time (ms)Avg Time (ms)
     -----  
  --
   _sg_mkldnn_conv   212  382184.0938   0.0340  
32.2100   0.1803
   _sg_mkldnn_fully_connected   45580.2979   0.1250 
 13.9900   0.1395
   CopyCPU2CPU 600026630.0391   0.0780  
 0.2140   0.1105
   BatchNorm   43444.3301   0.0360  
20.4180   0.0861
   SoftmaxOutput   42328.8540   0.0420  
23.9040   0.0582
   Pooling 83521.3201   0.0200  
21.3320   0.0440
   Flatten 4 889.5670   0.0170  
17.4920   0.0222
   WaitForVar  4 518.3480   0.0060  
 0.0290   0.0130
   DeleteVariable  2 169.5460   0.0040  
 0.0310   0.0085
   Reorder 4  75.0850   0.0010  
 0.0190   0.0019
   ```
   
   **mxnet-mkl==1.6**
   ```
   operator
   =
   Name  Total CountTime (ms)Min Time (ms)  
  Max Time (ms)Avg Time (ms)
     -----  
  --
   _sg_mkldnn_conv   106  196001.8281   0.0360  
31.9680   0.1849
   CopyCPU2CPU 300013590.7620   0.0860  
 0.1810   0.1197
   _sg_mkldnn_fully_connected   23062.9231   0.1370 
 25.2740   0.1531
   BatchNorm   21971.8280   0.0570  
26.9690   0.0986
   Pooling 41834.4380   0.0210  
21.8530   0.0459
   SoftmaxOutput   2 987.8520   0.0370  
19.0080   0.0494
   Flatten 2 462.1840   0.0170  
11.9900   0.0231
   WaitForVar  1 264.5960   0.0080  
 0.0300   0.0132
   DeleteVariable  1  90.5490   0.0050  
 0.0310   0.0091
   Reorder 2  48.6460   0.0020  
 0.0180   0.0024
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569084508
 
 
   @jonatan1626 I just created an auto-run script to run benchmark with MXNet 
profiler. You can find these files in my [gist 
repo](https://gist.github.com/wuxun-zhang/8e1bc466fd08bc78561fd1620bfe58c3). 
Firstly, you need to apply the patch `symbolic_run.diff` to your original repo, 
and then just run `./auto_run_with_profiler.sh` to collect profiling 
information (will print the results into stdout). Below is what I got in my 
local machine. 
   
   **mxnet-mkl 1.5.1**
   ```
   operator
   =
   Name  Total CountTime (ms)Min Time (ms)  
  Max Time (ms)Avg Time (ms)
     -----  
  --
   _sg_mkldnn_conv53   93196.5547   0.0440  
 2.7290   0.1758
   CopyCPU2CPU 100021750.9480   0.1330  
 0.2320   0.1751
   _sg_mkldnn_fully_connected   11408.5420   0.1180 
  0.4730   0.1409
   BatchNorm   1 889.8060   0.0480  
 0.4280   0.0890
   SoftmaxOutput   1 753.9630   0.0500  
 1.0160   0.0754
   Pooling 2 834.3010   0.0230  
 0.3370   0.0417
   Flatten 1 360.9760   0.0240  
 1.0100   0.0361
   WaitForVar  1  67.7780   0.0040  
 0.0230   0.0068
   Reorder 1  28.7770   0.0010  
 0.0130   0.0029
   ```
   
   **mxnet-mkl==1.4.1**
   ```
   operator
   =
   Name  Total CountTime (ms)Min Time (ms)  
  Max Time (ms)Avg Time (ms)
     -----  
  --
   SoftmaxOutput   1 310.8290   0.0240  
 0.0710   0.0311
   DeleteVariable  2  61.4390   0.  
 0.0120   0.0031
   Reorder 3 118.7160   0.0020  
 0.0120   0.0040
   WaitForVar  1  67.3600   0.0040  
 0.0160   0.0067
   Pooling 2 782.9750   0.0210  
 0.0790   0.0391
   _sg_mkldnn_conv53  106754.1406   0.0370  
 4.6030   0.2014
   BatchNorm   1 517.9470   0.0430  
 0.0670   0.0518
   FullyConnected  12523.4150   0.2110  
 0.6170   0.2523
   Flatten 11566.0520   0.1320  
 0.4620   0.1566
   CopyCPU2CPU 100021775.1851   0.1430  
 0.2000   0.1775
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
jonatan1626 commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569079572
 
 
   @pengzhao-intel sure I will look at the docs and can get the profiling 
numbers! 
   
   Also wanted to double check, we should look at: DL AMI 25/26, then do a pip 
install (1.4.1, 1.5.1, 1.6), and then build from source for 1.4.1 and 1.5.1 and 
run the benchmark? So a total of 12 different runs.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] nickguletskii opened a new pull request #17177: Bugfix/locale invariant stod

2019-12-26 Thread GitBox
nickguletskii opened a new pull request #17177: Bugfix/locale invariant stod
URL: https://github.com/apache/incubator-mxnet/pull/17177
 
 
   ## Description ##
   Currently, many operators utilize `std::stod` to convert strings into 
floating point numbers. This causes incorrect calculations (#17140, #16134) 
when the C locale is set to a locale which uses commas (`,`) as decimal point 
separators.
   
   This pull request replaces calls to `std::stod` and `std::stof` to 
`dmlc::stod` and `dmlc::stof` respectively.
   
   ### The scope of this patch ###
   
   This patch should fix a large portion of interactions through Python and JVM 
frontends, since they use locale-invariant serialization in order to pass 
parameters into MXNet's C API.
   
   However, frontends which utilize C locale-aware serialization (i.e. call 
`sprintf` or similar) may break when using locales which don't use `.` as the 
decimal separator. They will have to be fixed in a separate patch. I also 
suspect that they are already broken, because operators utilising dmlc-core 
parameter parsing were already using locale-invariant serialization.
   
   ### Further steps ###
   STL streams are heavily used within the codebase, both for serialization and 
for forming user-friendly messages. Fortunately, they don't seem to be affected 
by the C standard library locale settings. However, if someone sets the STL 
locale by calling 
[std::locale::global](https://en.cppreference.com/w/cpp/locale/locale/global), 
MXNet's API will be broken. In order to ensure that this doesn't happen, all 
streams which are used for serialization will have to be imbued with the "C" 
locale (not the locale set in the C standard library).
   
   It would be nice to see a more principled approach to serialization in MXNet 
2.0, e.g. using a binary format for communication between the frontend and the 
backend. In addition to solving locale-related issues, this would probably 
result in a smaller invocation overhead.
   
   ### Locale-invariant serialization vs locale-aware serialization ###
   
   As a side-note, using locale-aware serialization is not an option, simply 
because using `,` as the decimal separator adds ambiguities to tuple 
serialization, e.g. `(4,4,3)` can be a tuple of 3 integers, or a tuple of 2 
floats.
   
   
   
   ## 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](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] 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)
   - [x] 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 ###
   - [x] Replace `std::stod` with `dmlc::stod` and `std::stof with `dmlc::stof`.
   - [x] Add a test that tests locale invariance for scalar ops.
   
   ## Comments ##
   - May break Julia and R code when using a locale that uses `,` as the 
decimal separator. However, since there was no consistency between the various 
operators before, it is not unlikely that the code was already broken. 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] AssassinTee commented on issue #15891: Timeout on second predict

2019-12-26 Thread GitBox
AssassinTee commented on issue #15891: Timeout on second predict
URL: 
https://github.com/apache/incubator-mxnet/issues/15891#issuecomment-569069702
 
 
   No, it still doesn't work. I just worked around it by re-initalizing the 
model every prediciton


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 1.5.1

2019-12-26 Thread GitBox
wuxun-zhang commented on issue #17159: Performance regression from 1.4.1 to 
1.5.1
URL: 
https://github.com/apache/incubator-mxnet/issues/17159#issuecomment-569060884
 
 
   > @wuxun-zhang I think we need a document to illustrate how to debug 
performance for MXNet and MKLDNN like what we do for MKLDNN readme. Please try 
to write a draft and we can publish in website soon.
   
   Yes, that will be very helpful. I'll start this work.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet-site] branch asf-site updated: Bump the publish timestamp.

2019-12-26 Thread aaronmarkham
This is an automated email from the ASF dual-hosted git repository.

aaronmarkham pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet-site.git


The following commit(s) were added to refs/heads/asf-site by this push:
 new 07ac01a  Bump the publish timestamp.
07ac01a is described below

commit 07ac01a2de36e0fdd95e5c2d8d258998a36c19e1
Author: mxnet-ci 
AuthorDate: Thu Dec 26 12:42:50 2019 +

Bump the publish timestamp.
---
 date.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/date.txt b/date.txt
new file mode 100644
index 000..25e7917
--- /dev/null
+++ b/date.txt
@@ -0,0 +1 @@
+Thu Dec 26 12:42:50 UTC 2019



[GitHub] [incubator-mxnet] leezu commented on issue #17031: Use CMake standard library to handle CUDA

2019-12-26 Thread GitBox
leezu commented on issue #17031: Use CMake standard library to handle CUDA
URL: https://github.com/apache/incubator-mxnet/pull/17031#issuecomment-569043345
 
 
   Ping for review
   
   @szha @yajiedesign or anyone willing


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[incubator-mxnet] branch master updated (d26dd15 -> cf81887)

2019-12-26 Thread patriczhao
This is an automated email from the ASF dual-hosted git repository.

patriczhao pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from d26dd15  [numpy] add op round (#17175)
 add cf81887  Quantized Elemwise Mul Operator (#17147)

No new revisions were added by this update.

Summary of changes:
 ...wise_add-inl.h => quantized_elemwise_mul-inl.h} |  34 +--
 .../quantization/quantized_elemwise_mul.cc | 267 +
 ...=> mkldnn_elemwisemul_post_quantize_property.h} |  64 ++---
 .../subgraph/mkldnn/mkldnn_subgraph_property.cc|   2 +
 tests/python/quantization/test_quantization.py |  62 -
 5 files changed, 382 insertions(+), 47 deletions(-)
 copy src/operator/quantization/{quantized_elemwise_add-inl.h => 
quantized_elemwise_mul-inl.h} (63%)
 create mode 100644 src/operator/quantization/quantized_elemwise_mul.cc
 copy src/operator/subgraph/mkldnn/{mkldnn_fc_post_quantize_property.h => 
mkldnn_elemwisemul_post_quantize_property.h} (72%)



[GitHub] [incubator-mxnet] pengzhao-intel merged pull request #17147: Quantized Elemwise Mul Operator

2019-12-26 Thread GitBox
pengzhao-intel merged pull request #17147: Quantized Elemwise Mul Operator
URL: https://github.com/apache/incubator-mxnet/pull/17147
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] marcoabreu commented on a change in pull request #16980: change windows build system

2019-12-26 Thread GitBox
marcoabreu commented on a change in pull request #16980: change windows build 
system
URL: https://github.com/apache/incubator-mxnet/pull/16980#discussion_r361429662
 
 

 ##
 File path: tools/windowsbuild/warp_dll.cpp
 ##
 @@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+ 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+
+
+int find_version()
+{
+   int known_sm[] = { 30,35,37,50,52,60,61,70,75 };
 
 Review comment:
   Can you make that dynamic so we don't have to update it in the future?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] yajiedesign commented on issue #16980: change windows build system

2019-12-26 Thread GitBox
yajiedesign commented on issue #16980: change windows build system
URL: https://github.com/apache/incubator-mxnet/pull/16980#issuecomment-569026020
 
 
   ci test ok


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] fumingxing2015 commented on issue #16562: Same model but different time-consuming

2019-12-26 Thread GitBox
fumingxing2015 commented on issue #16562: Same model  but different 
time-consuming
URL: 
https://github.com/apache/incubator-mxnet/issues/16562#issuecomment-569024882
 
 
   > Hi,@fumingxing2015,I meet the same problem.I found the geem compute in 
convlution is very slow.Both MKL and Openblas are slow.
   > Do you have any suggestion about this problem.
   
   I only set the  small values to zero ,this can avoid the speed slow down and 
keep the accuracy no change. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] TaoLv commented on issue #16899: [WIP] Enable MKL-DNN in pip packages

2019-12-26 Thread GitBox
TaoLv commented on issue #16899: [WIP] Enable MKL-DNN in pip packages
URL: https://github.com/apache/incubator-mxnet/pull/16899#issuecomment-569022044
 
 
   @szha @perdasilva Could you please review? Is it possible to verify these 
changes in dev CD? Thanks.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #16865: [numpy]add op insert

2019-12-26 Thread GitBox
haojin2 commented on a change in pull request #16865: [numpy]add op insert
URL: https://github.com/apache/incubator-mxnet/pull/16865#discussion_r361410560
 
 

 ##
 File path: src/operator/numpy/np_insert_op-inl.h
 ##
 @@ -0,0 +1,638 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ *  Copyright (c) 2019 by Contributors
+ * \file np_insert_op-inl.h
+ * \brief Function definition of insert operators
+ */
+#ifndef MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+
+#include 
+#include 
+#include "../../common/utils.h"
+#include "../tensor/sort_op.h"
+#include "../tensor/init_op.h"
+#include "../operator_common.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct NumpyInsertParam : public dmlc::Parameter {
+  dmlc::optional val;
+  dmlc::optional start;
+  dmlc::optional stop;
+  dmlc::optional step;
+  dmlc::optional int_ind;
+  dmlc::optional axis;
+  DMLC_DECLARE_PARAMETER(NumpyInsertParam) {
+DMLC_DECLARE_FIELD(val)
+.set_default(dmlc::optional())
+.describe("A scaler to be inserted into 'array'");
+DMLC_DECLARE_FIELD(start)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'start' is one of it's arguments.");
+DMLC_DECLARE_FIELD(stop)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'stop' is one of it's arguments.");
+DMLC_DECLARE_FIELD(step)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'step' is one of it's arguments.");
+DMLC_DECLARE_FIELD(int_ind)
+.set_default(dmlc::optional())
+.describe("If 'obj' is int, 'int_ind' is the index before which"
+  "'values' is inserted");
+DMLC_DECLARE_FIELD(axis)
+.set_default(dmlc::optional())
+.describe("Axis along which to insert `values`.");
+  }
+};
+
+/*!
+ * \brief insert when obj is 'scaler' or a 'slice' with only one element.
+ * \tparam ndim - both 'in_arr', 'in_val' and 'out_data' have same ndim before 
call this.
+ * \param out_data - output: insert 'value' to 'arr' according to 'index'.
+ * \param in_arr - input: 'arr', original array.
+ * \param index - input(only for first Map): it's the only element in 'obj' 
indicats insert position.
+ * \param in_obj - input(only for second Map): It indicats insert position, 
it's ndim may equals to 0.
+ * \param in_val - input: 'value', insert to 'arr' according to 'index'.
+ * \param N - (only for first Map) arr.shape_[axis]
+ * \param numnew - extra dim size in 'out_data' compared with 'arr' in 'axis'.
+ * \param axis - insert 'value' to 'arr' in 'axis'.
+ * \param moveaxis - If 'obj' is a scaler, moveaxis is true;
+ If 'obj' is a slice with one element, moveaxis is false.
+ * \note Different between the two Map:
+ The first one use a scaler index;
+ The second one use a sequence of indecies which only has one index.
+ */
+template
+struct InsertSingleIndexForward {
+  template
+  MSHADOW_XINLINE static void Map(int i, DType* out_data,
+  const VType* in_val, const DType* in_arr,
+  const mshadow::Shape outshape,
+  const mshadow::Shape valshape,
+  const int index, const int numnew,
+  const mshadow::Shape val_stride,
+  const mshadow::Shape old_val_stride,
+  const mshadow::Shape arr_stride,
+  const mshadow::Shape out_stride,
+  const int axis, bool moveaxis, const int 
req) {
+// i is the global flattened index in the output
+// out_idx: i -> position in output's shape
+mshadow::Shape out_idx = mxnet_op::unravel(i, outshape);
+int64_t dest_idx;
+if (out_idx[axis] >= index && out_idx[axis] < index + numnew) {  // from 
'value'
+  int idx_val = out_idx[axis] - index;
+  // val_idx: i -> position in values's shape
+  mshadow::Shape val_idx(out_idx);
+  val_idx[axis] = idx_val;
+  for (int j = ndim - 1; j >= 0; --j) {
+if (valshape[j] == 1) {  // broadcast
+  va

[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #16865: [numpy]add op insert

2019-12-26 Thread GitBox
haojin2 commented on a change in pull request #16865: [numpy]add op insert
URL: https://github.com/apache/incubator-mxnet/pull/16865#discussion_r361410505
 
 

 ##
 File path: src/operator/numpy/np_insert_op-inl.h
 ##
 @@ -0,0 +1,638 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ *  Copyright (c) 2019 by Contributors
+ * \file np_insert_op-inl.h
+ * \brief Function definition of insert operators
+ */
+#ifndef MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+
+#include 
+#include 
+#include "../../common/utils.h"
+#include "../tensor/sort_op.h"
+#include "../tensor/init_op.h"
+#include "../operator_common.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct NumpyInsertParam : public dmlc::Parameter {
+  dmlc::optional val;
+  dmlc::optional start;
+  dmlc::optional stop;
+  dmlc::optional step;
+  dmlc::optional int_ind;
+  dmlc::optional axis;
+  DMLC_DECLARE_PARAMETER(NumpyInsertParam) {
+DMLC_DECLARE_FIELD(val)
+.set_default(dmlc::optional())
+.describe("A scaler to be inserted into 'array'");
+DMLC_DECLARE_FIELD(start)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'start' is one of it's arguments.");
+DMLC_DECLARE_FIELD(stop)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'stop' is one of it's arguments.");
+DMLC_DECLARE_FIELD(step)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'step' is one of it's arguments.");
+DMLC_DECLARE_FIELD(int_ind)
+.set_default(dmlc::optional())
+.describe("If 'obj' is int, 'int_ind' is the index before which"
+  "'values' is inserted");
+DMLC_DECLARE_FIELD(axis)
+.set_default(dmlc::optional())
+.describe("Axis along which to insert `values`.");
+  }
+};
+
+/*!
+ * \brief insert when obj is 'scaler' or a 'slice' with only one element.
+ * \tparam ndim - both 'in_arr', 'in_val' and 'out_data' have same ndim before 
call this.
+ * \param out_data - output: insert 'value' to 'arr' according to 'index'.
+ * \param in_arr - input: 'arr', original array.
+ * \param index - input(only for first Map): it's the only element in 'obj' 
indicats insert position.
+ * \param in_obj - input(only for second Map): It indicats insert position, 
it's ndim may equals to 0.
+ * \param in_val - input: 'value', insert to 'arr' according to 'index'.
+ * \param N - (only for first Map) arr.shape_[axis]
+ * \param numnew - extra dim size in 'out_data' compared with 'arr' in 'axis'.
+ * \param axis - insert 'value' to 'arr' in 'axis'.
+ * \param moveaxis - If 'obj' is a scaler, moveaxis is true;
+ If 'obj' is a slice with one element, moveaxis is false.
+ * \note Different between the two Map:
+ The first one use a scaler index;
+ The second one use a sequence of indecies which only has one index.
+ */
+template
+struct InsertSingleIndexForward {
+  template
+  MSHADOW_XINLINE static void Map(int i, DType* out_data,
+  const VType* in_val, const DType* in_arr,
+  const mshadow::Shape outshape,
+  const mshadow::Shape valshape,
+  const int index, const int numnew,
+  const mshadow::Shape val_stride,
+  const mshadow::Shape old_val_stride,
+  const mshadow::Shape arr_stride,
+  const mshadow::Shape out_stride,
+  const int axis, bool moveaxis, const int 
req) {
+// i is the global flattened index in the output
+// out_idx: i -> position in output's shape
+mshadow::Shape out_idx = mxnet_op::unravel(i, outshape);
+int64_t dest_idx;
+if (out_idx[axis] >= index && out_idx[axis] < index + numnew) {  // from 
'value'
+  int idx_val = out_idx[axis] - index;
+  // val_idx: i -> position in values's shape
+  mshadow::Shape val_idx(out_idx);
+  val_idx[axis] = idx_val;
+  for (int j = ndim - 1; j >= 0; --j) {
+if (valshape[j] == 1) {  // broadcast
+  va

[GitHub] [incubator-mxnet] TaoLv commented on a change in pull request #17049: Fix operators lying about their number of inputs

2019-12-26 Thread GitBox
TaoLv commented on a change in pull request #17049: Fix operators lying about 
their number of inputs
URL: https://github.com/apache/incubator-mxnet/pull/17049#discussion_r361410278
 
 

 ##
 File path: src/operator/nn/concat.cc
 ##
 @@ -394,6 +394,14 @@ CONCAT_FORWARD_ATTRS
 .add_arguments(ConcatParam::__FIELDS__());
 
 NNVM_REGISTER_OP(_backward_Concat)
+.set_num_inputs([](const NodeAttrs& attrs) {
+#if MXNET_USE_MKLDNN
 
 Review comment:
   `#if MXNET_USE_MKLDNN == 1`


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #16865: [numpy]add op insert

2019-12-26 Thread GitBox
haojin2 commented on a change in pull request #16865: [numpy]add op insert
URL: https://github.com/apache/incubator-mxnet/pull/16865#discussion_r361410505
 
 

 ##
 File path: src/operator/numpy/np_insert_op-inl.h
 ##
 @@ -0,0 +1,638 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ *  Copyright (c) 2019 by Contributors
+ * \file np_insert_op-inl.h
+ * \brief Function definition of insert operators
+ */
+#ifndef MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_INSERT_OP_INL_H_
+
+#include 
+#include 
+#include "../../common/utils.h"
+#include "../tensor/sort_op.h"
+#include "../tensor/init_op.h"
+#include "../operator_common.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct NumpyInsertParam : public dmlc::Parameter {
+  dmlc::optional val;
+  dmlc::optional start;
+  dmlc::optional stop;
+  dmlc::optional step;
+  dmlc::optional int_ind;
+  dmlc::optional axis;
+  DMLC_DECLARE_PARAMETER(NumpyInsertParam) {
+DMLC_DECLARE_FIELD(val)
+.set_default(dmlc::optional())
+.describe("A scaler to be inserted into 'array'");
+DMLC_DECLARE_FIELD(start)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'start' is one of it's arguments.");
+DMLC_DECLARE_FIELD(stop)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'stop' is one of it's arguments.");
+DMLC_DECLARE_FIELD(step)
+.set_default(dmlc::optional())
+.describe("If 'obj' is slice, 'step' is one of it's arguments.");
+DMLC_DECLARE_FIELD(int_ind)
+.set_default(dmlc::optional())
+.describe("If 'obj' is int, 'int_ind' is the index before which"
+  "'values' is inserted");
+DMLC_DECLARE_FIELD(axis)
+.set_default(dmlc::optional())
+.describe("Axis along which to insert `values`.");
+  }
+};
+
+/*!
+ * \brief insert when obj is 'scaler' or a 'slice' with only one element.
+ * \tparam ndim - both 'in_arr', 'in_val' and 'out_data' have same ndim before 
call this.
+ * \param out_data - output: insert 'value' to 'arr' according to 'index'.
+ * \param in_arr - input: 'arr', original array.
+ * \param index - input(only for first Map): it's the only element in 'obj' 
indicats insert position.
+ * \param in_obj - input(only for second Map): It indicats insert position, 
it's ndim may equals to 0.
+ * \param in_val - input: 'value', insert to 'arr' according to 'index'.
+ * \param N - (only for first Map) arr.shape_[axis]
+ * \param numnew - extra dim size in 'out_data' compared with 'arr' in 'axis'.
+ * \param axis - insert 'value' to 'arr' in 'axis'.
+ * \param moveaxis - If 'obj' is a scaler, moveaxis is true;
+ If 'obj' is a slice with one element, moveaxis is false.
+ * \note Different between the two Map:
+ The first one use a scaler index;
+ The second one use a sequence of indecies which only has one index.
+ */
+template
+struct InsertSingleIndexForward {
+  template
+  MSHADOW_XINLINE static void Map(int i, DType* out_data,
+  const VType* in_val, const DType* in_arr,
+  const mshadow::Shape outshape,
+  const mshadow::Shape valshape,
+  const int index, const int numnew,
+  const mshadow::Shape val_stride,
+  const mshadow::Shape old_val_stride,
+  const mshadow::Shape arr_stride,
+  const mshadow::Shape out_stride,
+  const int axis, bool moveaxis, const int 
req) {
+// i is the global flattened index in the output
+// out_idx: i -> position in output's shape
+mshadow::Shape out_idx = mxnet_op::unravel(i, outshape);
+int64_t dest_idx;
+if (out_idx[axis] >= index && out_idx[axis] < index + numnew) {  // from 
'value'
+  int idx_val = out_idx[axis] - index;
+  // val_idx: i -> position in values's shape
+  mshadow::Shape val_idx(out_idx);
+  val_idx[axis] = idx_val;
+  for (int j = ndim - 1; j >= 0; --j) {
+if (valshape[j] == 1) {  // broadcast
+  va

[incubator-mxnet] branch master updated (07913f9 -> d26dd15)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 07913f9  fix broken link (#17130)
 add d26dd15  [numpy] add op round (#17175)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/_op.py  | 27 +++---
 python/mxnet/numpy/multiarray.py   | 23 
 python/mxnet/numpy_dispatch_protocol.py|  1 +
 python/mxnet/symbol/numpy/_symbol.py   | 30 
 .../python/unittest/test_numpy_interoperability.py |  5 
 tests/python/unittest/test_numpy_op.py | 32 ++
 6 files changed, 103 insertions(+), 15 deletions(-)



[incubator-mxnet] branch master updated (07913f9 -> d26dd15)

2019-12-26 Thread haoj
This is an automated email from the ASF dual-hosted git repository.

haoj pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.


from 07913f9  fix broken link (#17130)
 add d26dd15  [numpy] add op round (#17175)

No new revisions were added by this update.

Summary of changes:
 python/mxnet/ndarray/numpy/_op.py  | 27 +++---
 python/mxnet/numpy/multiarray.py   | 23 
 python/mxnet/numpy_dispatch_protocol.py|  1 +
 python/mxnet/symbol/numpy/_symbol.py   | 30 
 .../python/unittest/test_numpy_interoperability.py |  5 
 tests/python/unittest/test_numpy_op.py | 32 ++
 6 files changed, 103 insertions(+), 15 deletions(-)



[GitHub] [incubator-mxnet] haojin2 merged pull request #17175: [numpy] add op round

2019-12-26 Thread GitBox
haojin2 merged pull request #17175: [numpy] add op round
URL: https://github.com/apache/incubator-mxnet/pull/17175
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] tranthanhtung04101995 commented on issue #17167: can't install mxnet-cu100

2019-12-26 Thread GitBox
tranthanhtung04101995 commented on issue #17167: can't install mxnet-cu100
URL: 
https://github.com/apache/incubator-mxnet/issues/17167#issuecomment-569018513
 
 
   i build mxnet. thank you.
   https://github.com/apache/incubator-mxnet/issues/14953#issuecomment-492966154


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] Tommliu opened a new pull request #17176: Op amax [Numpy]

2019-12-26 Thread GitBox
Tommliu opened a new pull request #17176: Op amax [Numpy]
URL: https://github.com/apache/incubator-mxnet/pull/17176
 
 
   ## Description ##
   Numpy Operator amax PR
   
   ## 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](https://issues.apache.org/jira/projects/MXNET/issues) 
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
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #16990: [numpy] add op matmul

2019-12-26 Thread GitBox
haojin2 commented on a change in pull request #16990: [numpy] add op matmul
URL: https://github.com/apache/incubator-mxnet/pull/16990#discussion_r361400249
 
 

 ##
 File path: src/operator/numpy/np_matmul_op-inl.h
 ##
 @@ -0,0 +1,424 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file np_matmul_op-inl.h
+ * \brief Function definition of matrix numpy-compatible matmul operator
+ */
+
+#ifndef MXNET_OPERATOR_NUMPY_NP_MATMUL_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_MATMUL_OP_INL_H_
+
+#include 
+#include 
+#include 
+#include 
+#include "../mxnet_op.h"
+#include "np_tensordot_op-inl.h"
+#include "np_dot-inl.h"
+
+namespace mxnet {
+namespace op {
+
+inline bool MatmulNeedBroadcast(const mxnet::TShape& ashape,
+const mxnet::TShape& bshape) {
+  bool need_bcast = false;
+  for (int i = ashape.ndim() - 3, j = bshape.ndim() - 3;
+   i >= 0 || j >=0; --i, --j) {
+if (i >= 0 && j >= 0) {
+  need_bcast |= (ashape[i] != bshape[j]);
+} else if (i >= 0) {
+  need_bcast |= (ashape[i] != 1);
+} else {
+  need_bcast |= (bshape[j] != 1);
+}
+  }
+  return need_bcast;
+}
+
+/*!
+ * \brief Get mshadow::Shape from mxnet::TShape.
+  i.e. input shape (2, 3), shape.ndim() = 2, but the ndim we want 
output shape
+  has is 'N' = 4, so return shape would be (1, 1, 2, 3). We put the 
outshape into
+  mshadow::Shape, 'ndim' may not equal to 'N'.
+ * \tparam ndim - ndim of output's argument.
+ * \param N - true ndim of output.
+ */
+template
+mshadow::Shape GetKernelShape(const mxnet::TShape& shape, size_t N) {
+  mshadow::Shapek_shape;
+  for (int i = shape.ndim() - 1, j = N - 1; i >= 0 || j >= 0 ; --i, --j) {
+if (i >= 0) {
+  k_shape[j] = shape[i];
+} else {
+  k_shape[j] = 1;
+}
+  }
+  return k_shape;
+}
+
+/*!
+ * \brief Broadcast in_shape to broadcast_shape in [dimstart, dimend].
+ Make sure that before use this function:
+ If in_shape[i] != broadcast_shape[i], in_shape[i] == 1.
+ * \param N - ndim of both in_shape and broadcast_shape.
+ * \param dimstart start dimension
+ * \param dimend end dimension
+ */
+template
+mshadow::Shape GetBroadcastKernelShape(mshadow::Shape in_shape,
+ mshadow::Shape 
broadcast_shape,
+ int dimstart, int dimend) {
+  CHECK_GE(dimstart, 0) << "dimstart must be >= 0, while received " << 
dimstart;
+  CHECK_LT(dimend, ndim) << "dimend must be < " << ndim
+ << ", while received " << dimend;
+  mshadow::Shapeout_shape(in_shape);
+  for (int i = dimstart; i < dimend; ++i) {
+out_shape[i] = std::max(in_shape[i], broadcast_shape[i]);
+  }
+  return out_shape;
+}
+
+struct SumByShape {
+  /*!
+   * \brief squash input into output by addition
+   * \example in_size = 10, out_size = 2, so,
+  output[0] = sum(input[0, 2, 4, 6, 8])
+  output[1] = sum(input[1, 3, 5, 7, 9])
+   * \param out - output: insert 'value' to 'arr' according to 'index'.
+   * \param a - input: the first argument.
+   * \param b - input: the second argument.
+   * \param ndim - ndim of a, b and output. Because of broadcast, regard their 
ndim as equal.  
+   */
+  template
+  MSHADOW_XINLINE static void Map(int i, DType* output, DType* input,
+  size_t in_size, size_t out_size,
+  const int req){
+// i is the global position in flattened output
+size_t pos = static_cast(i);
+DType temp = 0;
+while (pos < in_size) {
+  temp += input[pos];
+  pos += out_size;
+}
+KERNEL_ASSIGN(output[i], req, temp);
+  }
+};
+
+template
+inline void MatmulImpl(const OpContext& ctx,
+   const TBlob& input_a, const TBlob& input_b,
+   const OpReqType& req, const TBlob& output,
+   Tensor temp_mem,
+   const size_t ndim, const size_t batch_size,
+   const size_t bc_size_a, const size_t bc_size_b,
+   const mxnet::TShape& a_shape,
+   const mxnet::TShape& b_shape,
+   

[GitHub] [incubator-mxnet] haojin2 commented on a change in pull request #16990: [numpy] add op matmul

2019-12-26 Thread GitBox
haojin2 commented on a change in pull request #16990: [numpy] add op matmul
URL: https://github.com/apache/incubator-mxnet/pull/16990#discussion_r361399915
 
 

 ##
 File path: src/operator/numpy/np_matmul_op-inl.h
 ##
 @@ -0,0 +1,424 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file np_matmul_op-inl.h
+ * \brief Function definition of matrix numpy-compatible matmul operator
+ */
+
+#ifndef MXNET_OPERATOR_NUMPY_NP_MATMUL_OP_INL_H_
+#define MXNET_OPERATOR_NUMPY_NP_MATMUL_OP_INL_H_
+
+#include 
+#include 
+#include 
+#include 
+#include "../mxnet_op.h"
+#include "np_tensordot_op-inl.h"
+#include "np_dot-inl.h"
+
+namespace mxnet {
+namespace op {
+
+inline bool MatmulNeedBroadcast(const mxnet::TShape& ashape,
+const mxnet::TShape& bshape) {
+  bool need_bcast = false;
+  for (int i = ashape.ndim() - 3, j = bshape.ndim() - 3;
+   i >= 0 || j >=0; --i, --j) {
+if (i >= 0 && j >= 0) {
+  need_bcast |= (ashape[i] != bshape[j]);
+} else if (i >= 0) {
+  need_bcast |= (ashape[i] != 1);
+} else {
+  need_bcast |= (bshape[j] != 1);
+}
+  }
+  return need_bcast;
+}
+
+/*!
+ * \brief Get mshadow::Shape from mxnet::TShape.
+  i.e. input shape (2, 3), shape.ndim() = 2, but the ndim we want 
output shape
+  has is 'N' = 4, so return shape would be (1, 1, 2, 3). We put the 
outshape into
+  mshadow::Shape, 'ndim' may not equal to 'N'.
+ * \tparam ndim - ndim of output's argument.
+ * \param N - true ndim of output.
+ */
+template
+mshadow::Shape GetKernelShape(const mxnet::TShape& shape, size_t N) {
+  mshadow::Shapek_shape;
+  for (int i = shape.ndim() - 1, j = N - 1; i >= 0 || j >= 0 ; --i, --j) {
+if (i >= 0) {
+  k_shape[j] = shape[i];
+} else {
+  k_shape[j] = 1;
+}
+  }
+  return k_shape;
+}
+
+/*!
+ * \brief Broadcast in_shape to broadcast_shape in [dimstart, dimend].
+ Make sure that before use this function:
+ If in_shape[i] != broadcast_shape[i], in_shape[i] == 1.
+ * \param N - ndim of both in_shape and broadcast_shape.
+ * \param dimstart start dimension
+ * \param dimend end dimension
+ */
+template
+mshadow::Shape GetBroadcastKernelShape(mshadow::Shape in_shape,
+ mshadow::Shape 
broadcast_shape,
+ int dimstart, int dimend) {
+  CHECK_GE(dimstart, 0) << "dimstart must be >= 0, while received " << 
dimstart;
+  CHECK_LT(dimend, ndim) << "dimend must be < " << ndim
+ << ", while received " << dimend;
+  mshadow::Shapeout_shape(in_shape);
+  for (int i = dimstart; i < dimend; ++i) {
+out_shape[i] = std::max(in_shape[i], broadcast_shape[i]);
+  }
+  return out_shape;
+}
+
+struct SumByShape {
+  /*!
+   * \brief squash input into output by addition
+   * \example in_size = 10, out_size = 2, so,
+  output[0] = sum(input[0, 2, 4, 6, 8])
+  output[1] = sum(input[1, 3, 5, 7, 9])
+   * \param out - output: insert 'value' to 'arr' according to 'index'.
+   * \param a - input: the first argument.
+   * \param b - input: the second argument.
+   * \param ndim - ndim of a, b and output. Because of broadcast, regard their 
ndim as equal.  
+   */
+  template
+  MSHADOW_XINLINE static void Map(int i, DType* output, DType* input,
+  size_t in_size, size_t out_size,
+  const int req){
+// i is the global position in flattened output
+size_t pos = static_cast(i);
+DType temp = 0;
+while (pos < in_size) {
+  temp += input[pos];
+  pos += out_size;
+}
+KERNEL_ASSIGN(output[i], req, temp);
+  }
+};
+
+template
+inline void MatmulImpl(const OpContext& ctx,
+   const TBlob& input_a, const TBlob& input_b,
+   const OpReqType& req, const TBlob& output,
+   Tensor temp_mem,
+   const size_t ndim, const size_t batch_size,
+   const size_t bc_size_a, const size_t bc_size_b,
+   const mxnet::TShape& a_shape,
+   const mxnet::TShape& b_shape,
+