[GitHub] CoinCheung commented on a change in pull request #10000: [MXNET-80] Fix average pooling kernel size assignment error

2018-03-13 Thread GitBox
CoinCheung commented on a change in pull request #1: [MXNET-80] Fix average 
pooling kernel size assignment error
URL: https://github.com/apache/incubator-mxnet/pull/1#discussion_r174359301
 
 

 ##
 File path: src/operator/nn/pooling.cc
 ##
 @@ -98,9 +103,24 @@ static bool PoolingShape(const nnvm::NodeAttrs ,
   << "Pooling: Input data should be  3D in (batch, channel, x)"
   << " Or 4D in (batch, channel, y, x) "
   << " Or 5D in (batch, channel, d, y, x)";
+  CHECK_LE(dshape.ndim(), 5U)
+  << "Pooling: Input data should be  3D in (batch, channel, x)"
+  << " Or 4D in (batch, channel, y, x) "
+  << " Or 5D in (batch, channel, d, y, x)";
   TShape oshape = dshape;
   if (dshape.ndim() == 0) return false;
-  if (param.kernel.ndim() == 1) {
+  if (param.global_pool) {
+  if (dshape.ndim() == 3) {
+  oshape[2] = 1;
+  } else if (dshape.ndim() == 4) {
+  oshape[2] = 1;
+  oshape[3] = 1;
+  } else if (dshape.ndim() == 5) {
+  oshape[2] = 1;
+  oshape[3] = 1;
+  oshape[4] = 1;
+  }
 
 Review comment:
   I feel it is sort of dangerous to modify function definitions and add a 
input parameter. Do we have other choices ?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] zheng-da commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
zheng-da commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372913471
 
 
   but the error happens here: 
https://github.com/apache/incubator-mxnet/blob/master/tests/python/gpu/test_operator_gpu.py#L
   activation with sigmoid fails.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] thinksanky opened a new pull request #10099: fixed the order of adding the new version into tag list before updati…

2018-03-13 Thread GitBox
thinksanky opened a new pull request #10099: fixed the order of adding the new 
version into tag list before updati…
URL: https://github.com/apache/incubator-mxnet/pull/10099
 
 
   
   ## Description ##
   The order of adding the latest version to the tag list is fixed now. It is 
required for this to be added first and then call the AddVersion.py for proper 
linking of the versions.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] pengzhao-intel commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
pengzhao-intel commented on issue #10092: No "full" pooling convention support 
with MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372911501
 
 
   I think the current change is fine and the path can be back when MKL-DNN 
supports 'full' pooling convention. 
   @ashokei could you also share the implementation plan of MKL-DNN to the 
community?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] pengzhao-intel commented on issue #8532: mxnet-mkl (v0.12.0) crash when using (conda-installed) numpy with MKL

2018-03-13 Thread GitBox
pengzhao-intel commented on issue #8532: mxnet-mkl (v0.12.0) crash when using 
(conda-installed) numpy with MKL
URL: 
https://github.com/apache/incubator-mxnet/issues/8532#issuecomment-372910970
 
 
   @fhieber  @rsdubtso is correct. It caused by multiple omp lib. The 
workaround is to set MP_DUPLICATE_LIB_OK=TRUE .
   
   I am considering the final solution now. Will come back soon :)
   
   Error log:
   
   > [INFO:sockeye.training] Using bucketing. Default max_seq_len=(60, 60)
   > [INFO:__main__] Optimizer: adam
   > [INFO:__main__] Optimizer Parameters: {'wd': 0.0, 'learning_rate': 0.0003, 
'lr_scheduler': LearningRateSchedulerPlateauReduce(reduce_factor=0.50, 
reduce_num_not_improved=0), 'clip_gradient': 1.0, 'rescale_grad': 1.0}
   > [INFO:__main__] kvstore: device
   > [INFO:__main__] Gradient Compression: None
   > [INFO:__main__] Decode and Evaluate Device(s): cpu(0)
   > [INFO:sockeye.model] Saved config to 
"/home/chenxiny/newstest/wmt_model/config"
   > OMP: Error #15: Initializing libiomp5.so, but found libiomp5.so already 
initialized.
   > OMP: Hint: This means that multiple copies of the OpenMP runtime have been 
linked into the program. That is dangerous, since it can degrade performance or 
cause incorrect results. The best thing to do is to ensure that only a single 
OpenMP runtime is linked into the process, e.g. by avoiding static linking of 
the OpenMP runtime in any library. As an unsafe, unsupported, undocumented 
workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to 
allow the program to continue to execute, but that may cause crashes or 
silently produce incorrect results. For more information, please see 
http://www.intel.com/software/products/support/.
   > Aborted
   
   After setting the environment, the problem is gone.
   New log:
   
   > [INFO:sockeye.utils] Sockeye version 1.16.2 commit 
762ce78e4e49b9ba5d14eb0a48d97f19c8807707
   > [INFO:sockeye.utils] MXNet version 1.1.0
   > [INFO:sockeye.utils] Command: 
/home/chenxiny/anaconda3/lib/python3.6/site-packages/sockeye/train.py -s 
corpus.tc.BPE.de -t corpus.tc.BPE.en -vs newstest2016.tc.BPE.de -vt 
newstest2016.tc.BPE.en --num-embed 256 --rnn-num-hidden 512 
--rnn-attention-type dot --max-seq-len 60 --decode-and-evaluate 500 -o wmt_model
   > [INFO:sockeye.utils] Arguments: Namespace(allow_missing_params=False, 
batch_size=64, batch_type='sentence', bucket_width=10, 
checkpoint_frequency=1000, cnn_activation_type='glu', cnn_hidden_dropout=0.0, 
cnn_kernel_width=(3, 5), cnn_num_hidden=512, 
cnn_positional_embedding_type='learned', cnn_project_qkv=False, 
conv_embed_add_positional_encodings=False, conv_embed_dropout=0.0, 
conv_embed_max_filter_width=8, conv_embed_num_filters=(200, 200, 250, 250, 300, 
300, 300, 300), conv_embed_num_highway_layers=4, conv_embed_output_dim=None, 
conv_embed_pool_stride=5, decode_and_evaluate=500, 
decode_and_evaluate_device_id=None, decode_and_evaluate_use_cpu=False, 
decoder='rnn', device_ids=[-1], disable_device_locking=False, 
embed_dropout=(0.0, 0.0), embed_weight_init='default', encoder='rnn', 
fill_up='replicate', gradient_clipping_threshold=1.0, 
gradient_clipping_type='abs', gradient_compression_threshold=0.5, 
gradient_compression_type=None, initial_learning_rate=0.0003, 
keep_last_params=-1, kvstore='device', label_smoothing=0.0, 
layer_normalization=False, learning_rate_decay_optimizer_states_reset='off', 
learning_rate_decay_param_reset=False, learning_rate_half_life=10, 
learning_rate_reduce_factor=0.5, learning_rate_reduce_num_not_improved=3, 
learning_rate_schedule=None, learning_rate_scheduler_type='plateau-reduce', 
learning_rate_warmup=0, lock_dir='/tmp', loss='cross-entropy', 
loss_normalization_type='valid', max_num_checkpoint_not_improved=8, 
max_num_epochs=None, max_seq_len=(60, 60), max_updates=None, 
metrics=['perplexity'], min_num_epochs=None, momentum=None, 
monitor_pattern=None, monitor_stat_func='mx_default', no_bucketing=False, 
num_embed=(256, 256), num_layers=(1, 1), num_words=(5, 5), 
optimized_metric='perplexity', optimizer='adam', optimizer_params=None, 
output='wmt_model', overwrite_output=False, params=None, prepared_data=None, 
quiet=False, rnn_attention_coverage_num_hidden=1, 
rnn_attention_coverage_type='count', rnn_attention_in_upper_layers=False, 
rnn_attention_mhdot_heads=None, rnn_attention_num_hidden=None, 
rnn_attention_type='dot', rnn_attention_use_prev_word=False, 
rnn_cell_type='lstm', rnn_context_gating=False, rnn_decoder_hidden_dropout=0.0, 
rnn_decoder_state_init='last', rnn_dropout_inputs=(0.0, 0.0), 
rnn_dropout_recurrent=(0.0, 0.0), rnn_dropout_states=(0.0, 0.0), 
rnn_encoder_reverse_input=False, rnn_first_residual_layer=2, 
rnn_forget_bias=0.0, rnn_h2h_init='orthogonal', rnn_num_hidden=512, 
rnn_residual_connections=False, seed=13, shared_vocab=False, 
source='corpus.tc.BPE.de', source_vocab=None, target='corpus.tc.BPE.en', 
target_vocab=None, transformer_activation_type='relu', 

[GitHub] CoinCheung commented on a change in pull request #10000: [MXNET-80] Fix average pooling kernel size assignment error

2018-03-13 Thread GitBox
CoinCheung commented on a change in pull request #1: [MXNET-80] Fix average 
pooling kernel size assignment error
URL: https://github.com/apache/incubator-mxnet/pull/1#discussion_r174356271
 
 

 ##
 File path: src/operator/nn/pooling.cc
 ##
 @@ -98,9 +103,24 @@ static bool PoolingShape(const nnvm::NodeAttrs ,
   << "Pooling: Input data should be  3D in (batch, channel, x)"
   << " Or 4D in (batch, channel, y, x) "
   << " Or 5D in (batch, channel, d, y, x)";
+  CHECK_LE(dshape.ndim(), 5U)
+  << "Pooling: Input data should be  3D in (batch, channel, x)"
+  << " Or 4D in (batch, channel, y, x) "
+  << " Or 5D in (batch, channel, d, y, x)";
   TShape oshape = dshape;
   if (dshape.ndim() == 0) return false;
-  if (param.kernel.ndim() == 1) {
+  if (param.global_pool) {
+  if (dshape.ndim() == 3) {
+  oshape[2] = 1;
+  } else if (dshape.ndim() == 4) {
+  oshape[2] = 1;
+  oshape[3] = 1;
+  } else if (dshape.ndim() == 5) {
+  oshape[2] = 1;
+  oshape[3] = 1;
+  oshape[4] = 1;
+  }
 
 Review comment:
   There is another mismatch at this line:
   
https://github.com/apache/incubator-mxnet/blob/c9ec3118688c233a66ad847003a9e8d2d09e5952/src/operator/nn/pool.h#L690
   and I have no idea how I could fix this as this function pool() have no 
global_pool as input parameter. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] nihui opened a new pull request #10098: implement DepthwiseConv2dBackwardFilterKernel from tensorflow codebase

2018-03-13 Thread GitBox
nihui opened a new pull request #10098: implement 
DepthwiseConv2dBackwardFilterKernel from tensorflow codebase
URL: https://github.com/apache/incubator-mxnet/pull/10098
 
 
   implement DepthwiseConv2dBackwardFilterKernel from tensorflow codebase, 
which is over 5x faster
   
   ## Description ##
   The current mxnet implementation calls __syncthreads() function too much, 
which is extemely slow.
   The new code comes from tensorflow, but the variable names are adjusted for 
consistency.
   
   My model uses depthwise conv heavily, and now its training time per 
iteration is over 5x faster on single P40 gpu.  ( old 92s vs new 18s )
   
   
   ## Checklist ##
   ### Essentials ###
   - [ ] Passed code style checking (`make lint`)
   - [x] 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)
   - [x] Code is well-documented: 
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] pengzhao-intel commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
pengzhao-intel commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372908964
 
 
   Look at the code, two implementations are the difference for the soft_relu. 
So, we get the different results.
   
   mxnet:
   
https://github.com/apache/incubator-mxnet/blob/c9ec3118688c233a66ad847003a9e8d2d09e5952/src/operator/mshadow_op.h#L136
   
   ```
   /*! \brief SoftReLU, also known as softplus activation */
   struct softrelu : public mxnet_op::tunable {
 template
 MSHADOW_XINLINE static DType Map(DType a) {
   // Avoid overflow of exp for large inputs.
   // Thresholds 20.0 is chosen such that softrelu(a) = a
   // for a > 20 using floating precision
   if (a > DType(20.0f)) {
 return a;
   } else {
 return DType(math::log1p(math::exp(a)));
   }
 }
   };
   
   MXNET_UNARY_MATH_OP(softrelu_grad, -math::expm1(-a));
   
   ```
   
   mkldnn:
   
https://github.com/intel/mkl-dnn/blob/f5218ff4fd2d16d13aada2e632afd18f2514fee3/tests/gtests/test_eltwise.cpp#L101
   
   
   ```
   template 
   T soft_relu_fwd(T s) {
   return logf(1 + ::expf(s));
   }
   
   template 
   T soft_relu_bwd(T dd, T s) {
   return dd / (1 + ::expf(-s));
   }
   ```
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] chinakook opened a new issue #10097: When to merge mxnet-fold to master?

2018-03-13 Thread GitBox
chinakook opened a new issue #10097: When to merge mxnet-fold to master?
URL: https://github.com/apache/incubator-mxnet/issues/10097
 
 
   I found [mxnet-fold](https://github.com/szha/mxnet-fold) is very useful in 
some situation, so I wonder that when to merge this feature to master.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on issue #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on issue #10090: [MXNET-86] Revert to pre-profile-changes 
copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#issuecomment-372905350
 
 
   yeah I actually tried setting omp_num_threads() to one there earlier today 
but it didn’t fix it. I think we’ll need to find proc addresses for some gomp 
functions like in that link above and reset libgomp.  Be cool if someone can 
create a JIRA ticket for that 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on issue #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on issue #10090: [MXNET-86] Revert to pre-profile-changes 
copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#issuecomment-372903762
 
 
   @cjolivier01 Eric said that `pthread_atfork` that is used in the engine code 
(https://github.com/apache/incubator-mxnet/blob/4bcca8cc00986b23116cc7841d162ed2111ded83/src/engine/threaded_engine_perdevice.cc#L57-L70)
 may be related to the problem


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on issue #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on issue #10090: [MXNET-86] Revert to pre-profile-changes 
copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#issuecomment-372903762
 
 
   @cjolivier01 Eric said that `pthread_atfork` 
http://pubs.opengroup.org/onlinepubs/007904975/functions/pthread_atfork.html 
might be helpful for solving the problem.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: [MXNET-86] Revert to pre-profile-changes copy code (#10090)

2018-03-13 Thread sxjscience
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
 new c9ec311  [MXNET-86] Revert to pre-profile-changes copy code (#10090)
c9ec311 is described below

commit c9ec3118688c233a66ad847003a9e8d2d09e5952
Author: Chris Olivier 
AuthorDate: Tue Mar 13 21:36:16 2018 -0700

[MXNET-86] Revert to pre-profile-changes copy code (#10090)

* Revert to pre-profile-changes copy code

* Add test

* Trigger rebuild
---
 src/ndarray/ndarray_function.cc  | 19 ++--
 tests/python/unittest/test_gluon_data.py | 81 
 2 files changed, 85 insertions(+), 15 deletions(-)

diff --git a/src/ndarray/ndarray_function.cc b/src/ndarray/ndarray_function.cc
index 927c906..552555a 100644
--- a/src/ndarray/ndarray_function.cc
+++ b/src/ndarray/ndarray_function.cc
@@ -26,7 +26,6 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
@@ -34,27 +33,17 @@ template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
-  } else {
-mshadow::Copy(to->FlatTo1D(), from.FlatTo1D());
-  }
+mshadow::Copy(to->FlatTo1D(),
+  from.FlatTo1D());
 } else {
 MSHADOW_TYPE_SWITCH(from.type_flag_, SrcDType, {
 to->FlatTo1D() =
-  mshadow::expr::tcast(from.FlatTo1D());
+mshadow::expr::tcast(from.FlatTo1D());
 })
 }
-  });
+  })
 }
 
 template
diff --git a/tests/python/unittest/test_gluon_data.py 
b/tests/python/unittest/test_gluon_data.py
index 49b1b8e..93160aa 100644
--- a/tests/python/unittest/test_gluon_data.py
+++ b/tests/python/unittest/test_gluon_data.py
@@ -20,8 +20,14 @@ import tarfile
 import unittest
 import mxnet as mx
 import numpy as np
+import random
 from mxnet import gluon
+import platform
 from common import setup_module, with_seed
+from mxnet.gluon.data import DataLoader
+import mxnet.ndarray as nd
+from mxnet import context
+from mxnet.gluon.data.dataset import Dataset
 
 @with_seed()
 def test_array_dataset():
@@ -112,6 +118,81 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_forked_data_loader():
+"""
+Test should successfully run its course of multi-process/forked data 
loader without errors
+"""
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = 

[GitHub] sxjscience closed pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience closed pull request #10090: [MXNET-86] Revert to pre-profile-changes 
copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/ndarray/ndarray_function.cc b/src/ndarray/ndarray_function.cc
index 927c90690a4..552555adf84 100644
--- a/src/ndarray/ndarray_function.cc
+++ b/src/ndarray/ndarray_function.cc
@@ -26,7 +26,6 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
@@ -34,27 +33,17 @@ template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
-  } else {
-mshadow::Copy(to->FlatTo1D(), from.FlatTo1D());
-  }
+mshadow::Copy(to->FlatTo1D(),
+  from.FlatTo1D());
 } else {
 MSHADOW_TYPE_SWITCH(from.type_flag_, SrcDType, {
 to->FlatTo1D() =
-  mshadow::expr::tcast(from.FlatTo1D());
+mshadow::expr::tcast(from.FlatTo1D());
 })
 }
-  });
+  })
 }
 
 template
diff --git a/tests/python/unittest/test_gluon_data.py 
b/tests/python/unittest/test_gluon_data.py
index 49b1b8e935f..93160aa0940 100644
--- a/tests/python/unittest/test_gluon_data.py
+++ b/tests/python/unittest/test_gluon_data.py
@@ -20,8 +20,14 @@
 import unittest
 import mxnet as mx
 import numpy as np
+import random
 from mxnet import gluon
+import platform
 from common import setup_module, with_seed
+from mxnet.gluon.data import DataLoader
+import mxnet.ndarray as nd
+from mxnet import context
+from mxnet.gluon.data.dataset import Dataset
 
 @with_seed()
 def test_array_dataset():
@@ -112,6 +118,81 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_forked_data_loader():
+"""
+Test should successfully run its course of multi-process/forked data 
loader without errors
+"""
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', 

[GitHub] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899924
 
 
   can we add tests for the race condition? 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899924
 
 
   can we add tests for the race condition? 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10096: Fix multi worker

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#discussion_r174349573
 
 

 ##
 File path: python/mxnet/gluon/data/dataloader.py
 ##
 @@ -119,6 +119,71 @@ def worker_loop(dataset, key_queue, data_queue, 
batchify_fn):
 batch = batchify_fn([dataset[i] for i in samples])
 data_queue.put((idx, batch))
 
+class _MultiWorkerIter(object):
+"""Interal multi-worker iterator for DataLoader."""
+def __init__(self, num_workers, dataset, batchify_fn, batch_sampler):
+assert num_workers > 0, "_MultiWorkerIter is not for {} 
workers".format(num_workers)
+self._num_workers = num_workers
+self._dataset = dataset
+self._batchify_fn = batchify_fn
+self._batch_sampler = batch_sampler
+self._key_queue = Queue()
+self._data_queue = Queue(2*self._num_workers)
+self._data_buffer = {}
+self._index = 0
+self._shutdown = False
+
+workers = []
+for _ in range(self._num_workers):
+worker = multiprocessing.Process(
+target=worker_loop,
+args=(self._dataset, self._key_queue, self._data_queue, 
self._batchify_fn))
+worker.daemon = True
+worker.start()
+workers.append(worker)
+
+for idx, batch in enumerate(self._batch_sampler):
+self._key_queue.put((idx, batch))
 
 Review comment:
   May still need to revise the logic in later PRs to dynamically push more 
jobs into the key_queue.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899569
 
 
   I will patch this and test on our speech dataset. This will take approx. 2 
day


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899569
 
 
   I will patch this and test on our speech dataset. This will take approx. 1 
day


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899569
 
 
   I will patch this and test on our speech dataset


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
Jerryzcn commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899201
 
 
   thank god


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on issue #10096: Fix multi worker

2018-03-13 Thread GitBox
sxjscience commented on issue #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096#issuecomment-372899155
 
 
   @cjolivier01 @Jerryzcn 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] haoliyoupai09 commented on issue #6635: OnlyImplementedInNDArray

2018-03-13 Thread GitBox
haoliyoupai09 commented on issue #6635: OnlyImplementedInNDArray
URL: https://github.com/apache/incubator-mxnet/pull/6635#issuecomment-372896258
 
 
   That helps, thanks a lot.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] zhreshold opened a new pull request #10096: Fix multi worker

2018-03-13 Thread GitBox
zhreshold opened a new pull request #10096: Fix multi worker
URL: https://github.com/apache/incubator-mxnet/pull/10096
 
 
   ## Description ##
   - Fix race condition for CPUSharedStorageManager->Free
   - Launch workers at iter init stage to avoid frequent relaunch
   
   @piiswrong @sxjscience @yajiedesign 
   
   Still working on extra occupied memory by each worker(?) on gpu(0) when 
num_workers>0.
   Any clue is very appreciated.
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] 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
   - [ ] To the my best 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 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] szha commented on a change in pull request #10074: Add vocabulary and embedding

2018-03-13 Thread GitBox
szha commented on a change in pull request #10074: Add vocabulary and embedding
URL: https://github.com/apache/incubator-mxnet/pull/10074#discussion_r174341439
 
 

 ##
 File path: python/mxnet/gluon/text/embedding.py
 ##
 @@ -29,10 +29,10 @@
 import warnings
 import zipfile
 
-from . import _constants as C
-from mxnet import ndarray as nd
+from mxnet import nd
 
 Review comment:
   we usually use relative import.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] szha commented on issue #6635: OnlyImplementedInNDArray

2018-03-13 Thread GitBox
szha commented on issue #6635: OnlyImplementedInNDArray
URL: https://github.com/apache/incubator-mxnet/pull/6635#issuecomment-372888019
 
 
   The error message you got is accurate in that the in-place add is indeed not 
available in symbol. Instead of doing `sym_a += sym_b`, you can do `sym_a = 
sym_a + sym_b`.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] xinyu-intel commented on issue #9918: [MXNET-74]Update mkldnn to the newest & Add clang build test with mkldnn.

2018-03-13 Thread GitBox
xinyu-intel commented on issue #9918: [MXNET-74]Update mkldnn to the newest & 
Add clang build test with mkldnn.
URL: https://github.com/apache/incubator-mxnet/pull/9918#issuecomment-372883194
 
 
   @marcoabreu  @cjolivier01 please help confirm the latest changes, Thanks!


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] haoliyoupai09 commented on issue #9667: [Feature request] += operator for Symbol

2018-03-13 Thread GitBox
haoliyoupai09 commented on issue #9667: [Feature request] += operator for Symbol
URL: 
https://github.com/apache/incubator-mxnet/issues/9667#issuecomment-372882885
 
 
   raise NotImplementedForSymbol(self.__iadd__, '+=', other, 1)
   mxnet.base.NotImplementedForSymbol: Function __iadd__ (namely operator "+=") 
with arguments (, ) is not 
implemented for Symbol and only available in NDArray.
   
   When I compile a project using mxnet, I met the error like this. The mxnet 
is complied successfully and import mxnet in python is also right. Could you 
tell me what to do?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] safrooze commented on issue #8593: Runtime errors during forward in a custom gluon.Block

2018-03-13 Thread GitBox
safrooze commented on issue #8593: Runtime errors during forward in a custom 
gluon.Block
URL: 
https://github.com/apache/incubator-mxnet/issues/8593#issuecomment-372881526
 
 
   This is a question that preferably is asked on 
[discuss.mxnet.io](https://discuss.mxnet.io/). To answer your question, you 
cannot use asnumpy() in the middle of computational graph because autograd can 
only record operations performed on ndarray.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ashokei commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
ashokei commented on issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372879308
 
 
   not been implemented by mkldnn for this specific case, hence with fix in 
#10021 we fallback to CPU just like any other feature/configure that is not 
currently implemented/supported-by-mkldnn-integration.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] feevos commented on issue #9822: gluon HybridBlock wrapper of constant nd.array, is it possible?

2018-03-13 Thread GitBox
feevos commented on issue #9822: gluon HybridBlock wrapper of constant 
nd.array, is it possible?
URL: 
https://github.com/apache/incubator-mxnet/issues/9822#issuecomment-372877890
 
 
   Thanks @jmacglashan  you are right. On mxnet [discuss 
forum](https://discuss.mxnet.io/t/custom-layer-infer-shape-after-first-forward-pass/585/7)
 I was given a solution that does exactly what you describe:
   ```Python
   class CustomConv(HybridBlock):
   def __init__(self, const_ndarray, use_bias = True, **kwargs):
   super(CustomConv, self).__init__(**kwargs)
   self.use_bias = use_bias 
   
   with self.name_scope():
   self.weight = self.params.get('weight', 
 shape=(100, 100, 3, 3),
 allow_deferred_init=True)
   self.bijkl = self.params.get(
   'bijkl', 
   shape=const_ndarray.shape,
   init=mx.init.Constant(const_ndarray.asnumpy().tolist()), 
   differentiable=False)
   
   if self.use_bias:
   self.bias = self.params.get(
   'bias',
   allow_deferred_init=True,
   init = mx.init.Zero(),
   shape=(100,))
   
   def hybrid_forward(self, F, x, weight, bijkl, bias=None):
   proj_weight = F.sum(F.dot(weight, bijkl), axis=[2, 3])
   
   if self.use_bias:
   return F.Convolution(data=x, weight=proj_weight, bias=bias, 
num_filter=100, kernel=(5, 5))
   
   else:
   
   return F.Convolution(data=x, weight=proj_weight, no_bias=True, 
num_filter=100, kernel=(5, 5))
   
   ```
   
   Only issue still left is that **I cannot (yet) infer the shape (of some 
dimension) during first run**.  Getting there ... 
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] feevos commented on issue #9822: gluon HybridBlock wrapper of constant nd.array, is it possible?

2018-03-13 Thread GitBox
feevos commented on issue #9822: gluon HybridBlock wrapper of constant 
nd.array, is it possible?
URL: 
https://github.com/apache/incubator-mxnet/issues/9822#issuecomment-372877890
 
 
   Thanks @jmacglashan  you are right. On mxnet [discuss 
forum](https://discuss.mxnet.io/t/custom-layer-infer-shape-after-first-forward-pass/585/7)
 I was given a solution that does exactly what you describe:
   ```Python
   class CustomConv(HybridBlock):
   def __init__(self, const_ndarray, use_bias = True, **kwargs):
   super(CustomConv, self).__init__(**kwargs)
   self.use_bias = use_bias 
   
   with self.name_scope():
   self.weight = self.params.get('weight', 
 shape=(100, 100, 3, 3),
 allow_deferred_init=True)
   self.bijkl = self.params.get(
   'bijkl', 
   shape=const_ndarray.shape,
   init=mx.init.Constant(const_ndarray.asnumpy().tolist()), 
   differentiable=False)
   
   if self.use_bias:
   self.bias = self.params.get(
   'bias',
   allow_deferred_init=True,
   init = mx.init.Zero(),
   shape=(100,))
   
   def hybrid_forward(self, F, x, weight, bijkl, bias=None):
   proj_weight = F.sum(F.dot(weight, bijkl), axis=[2, 3])
   
   if self.use_bias:
   return F.Convolution(data=x, weight=proj_weight, bias=bias, 
num_filter=100, kernel=(5, 5))
   
   else:
   
   return F.Convolution(data=x, weight=proj_weight, no_bias=True, 
num_filter=100, kernel=(5, 5))
   
   ```
   
   Only issue still left is that I cannot (yet) infer the shape (of some 
dimension) during first run.  Getting there ... 
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] chinakook opened a new issue #10095: BatchNorm on axis=-1 is very slower than axis=1

2018-03-13 Thread GitBox
chinakook opened a new issue #10095: BatchNorm on axis=-1 is very slower than 
axis=1
URL: https://github.com/apache/incubator-mxnet/issues/10095
 
 
   As profiler shows, the "nn.BatchNorm(axis=-1)" will cause 10x lower speed on 
my application than "nn.BatchNorm(axis=1)".
   However, We often need a "nn.BatchNorm(axis=-1)" after 
"nn.Dense(flatten=False)".


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] anirudh2290 opened a new pull request #10094: [MXNET-89] [WIP] Bug fix for bucketing module

2018-03-13 Thread GitBox
anirudh2290 opened a new pull request #10094: [MXNET-89] [WIP] Bug fix for 
bucketing module
URL: https://github.com/apache/incubator-mxnet/pull/10094
 
 
   ## Description ##
   Fix #9405
   
   ## Checklist ##
   ### Essentials ###
   - [ ] Passed code style checking (`make lint`)
   - [ ] 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
   - [ ] To the my best 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 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] ThomasDelteil commented on issue #10093: Cannot print summary of models loaded from onnx-mxnet

2018-03-13 Thread GitBox
ThomasDelteil commented on issue #10093: Cannot print summary of models loaded 
from onnx-mxnet
URL: 
https://github.com/apache/incubator-mxnet/issues/10093#issuecomment-372875127
 
 
   work around:
   `sym.save('symbol.json')`
   replace the "True" and "False" with "1" and "0"
   `sym = mx.sym.load('symbol.json')`


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ThomasDelteil opened a new issue #10093: Cannot print summary of models loaded from onnx-mxnet

2018-03-13 Thread GitBox
ThomasDelteil opened a new issue #10093: Cannot print summary of models loaded 
from onnx-mxnet
URL: https://github.com/apache/incubator-mxnet/issues/10093
 
 
   ## Description
   Trying to print a model loaded from onnx-mxnet does not work because the 
value of `node["attrs"]["no_bias"]` is `"False"` rather than `False`.
   
   Not sure if an mxnet issue or onnx-mxnet issue
   
   ## Environment info (Required)
   MXNet 1.1.0
   
   Package used (Python/R/Scala/Julia):
   I am using python
   
   ## Minimum reproducible example
   Download the model here: 
https://s3.amazonaws.com/download.onnx/models/shufflenet.tar.gz
   ```
   sym, params = onnx_mxnet.import_model(onnx_path)
   mx.visualization.print_summary(sym)
   ```
   
   ```
   ---
   ValueErrorTraceback (most recent call last)
in ()
   > 1 mx.visualization.print_summary(sym)
   
   ~/anaconda3/lib/python3.6/site-packages/mxnet/visualization.py in 
print_summary(symbol, shape, line_length, positions)
   182 if key in shape_dict:
   183 out_shape = shape_dict[key][1:]
   --> 184 total_params += print_layer_summary(nodes[i], out_shape)
   185 if i == len(nodes) - 1:
   186 print('=' * line_length)
   
   ~/anaconda3/lib/python3.6/site-packages/mxnet/visualization.py in 
print_layer_summary(node, out_shape)
   135 cur_param = 0
   136 if op == 'Convolution':
   --> 137 if ("no_bias" in node["attrs"]) and 
int(node["attrs"]["no_bias"]):
   138 cur_param = pre_filter * 
int(node["attrs"]["num_filter"])
   139 for k in _str2tuple(node["attrs"]["kernel"]):
   
   ValueError: invalid literal for int() with base 10: 'False'
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
marcoabreu commented on issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372869822
 
 
   Thanks a lot for the explanation. 
   
   Does it fail because it has not been implemented by MKLDNN or because the 
implementation itself fails?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] pengzhao-intel commented on issue #10075: [MXNET-83] Fix CMake build issue with MKL.

2018-03-13 Thread GitBox
pengzhao-intel commented on issue #10075: [MXNET-83] Fix CMake build issue with 
MKL.
URL: https://github.com/apache/incubator-mxnet/pull/10075#issuecomment-372868894
 
 
   @anirudh2290 it's in the MKL-DNN readme by "Intel MKL small libraries" and I 
am working on improving the explanations. I will update these descriptions into 
MXNET doc later.
   
   https://github.com/intel/mkl-dnn/blob/master/README.md#installation
   
   @KellenSunderland I am looking the changes and try to understand the logic. 
Will back to you soon.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] zheng-da commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
zheng-da commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372867710
 
 
   I wanted to test if MKLDNN activation is working now. We can close the PR 
for now and reopen it after the bug in MKLDNN is fixed, or just keep it open. 
Either way is fine.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] pengzhao-intel commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
pengzhao-intel commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372867519
 
 
   @zheng-da thanks a lot. I will follow up with our team :)


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ashokei commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
ashokei commented on issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372866683
 
 
   @marcoabreu The issue is with a specific SSD-VGG16-reduced model, in which 
pooling convention of full (only with maxpool) causes failure. 
   
   The solution in #10021 is to fall-back to CPU maxpool/full-pooling 
convention.  This fallback approach is used anytime we have a config/option not 
supported by mkl-dnn integration yet. So this is not a "bug" per se. It would 
be feature that may be enabled / implemented in future. I would remove "bug" as 
it is misleading for this ticket. With the fix in #10021 this issue will be 
resolved.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ashokei commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
ashokei commented on issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372866683
 
 
   @marcoabreu The issue is with a specific SSD-VGG16-reduced model, in which 
pooling convention of full (only with maxpool) causes failure. 
   
   The solution in #10021 is to fall-back to CPU maxpool/full-pooling 
convention.  This fallback approach is used anytime we have a config/option not 
supported by mkl-dnn integration yet. So this is not a "bug" per se. It would 
be a feature that may be enabled / implemented in future. 
   
   I would remove "bug" as it is misleading for this ticket. With the fix in 
#10021 this issue will be resolved.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ashokei commented on issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
ashokei commented on issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: 
https://github.com/apache/incubator-mxnet/issues/10092#issuecomment-372866683
 
 
   @marcoabreu The issue is with a specific SSD-VGG16-reduced model, in which 
pooling convention of full (only with maxpool) causes failure. 
   
   The solution in #10021 is to fall-back to CPU maxpool/full-pooling 
convention.  This fallback approach is used anytime we have a config/option not 
supported by mkl-dnn integration yet. So this is not a "bug" per se. It would 
be feature that may be enabled / implemented in future. I would remove "bug" as 
it is misleading for this ticket. With the fix in @10021 this issue will be 
resolved.
   
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
marcoabreu commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372866159
 
 
   I see, thanks a lot! So we'll wait to merge this until Intel fixed the 
problem or how would you propose to move forward?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] zheng-da commented on issue #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
zheng-da commented on issue #10089: enable all activations in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#issuecomment-372865309
 
 
   it seems the precision problem hasn't been fixed in mkldnn. I'm notify them 
of this problem. hopefully, it can be fixed soon.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on issue #10088: R can not install, 404 Not Found

2018-03-13 Thread GitBox
marcoabreu commented on issue #10088: R can not install, 404 Not Found
URL: 
https://github.com/apache/incubator-mxnet/issues/10088#issuecomment-372864754
 
 
   Hello, MXNet 0.10.1 is a quite old version - the latest released version is 
1.1. Would you mind explaining where you found the instructions to install that 
version and which commands you're running?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] astonzhang commented on a change in pull request #10074: Add vocabulary and embedding

2018-03-13 Thread GitBox
astonzhang commented on a change in pull request #10074: Add vocabulary and 
embedding
URL: https://github.com/apache/incubator-mxnet/pull/10074#discussion_r174324845
 
 

 ##
 File path: python/mxnet/text/embedding.py
 ##
 @@ -38,8 +38,12 @@
 
 def register(embedding_cls):
 """Registers a new token embedding.
+
+
 Once an embedding is registered, we can create an instance of this 
embedding with
-:func:`~mxnet.contrib.text.embedding.create`.
+:func:`~mxnet.text.embedding.create`.
+
+
 Examples
 
 >>> @mxnet.contrib.text.embedding.register
 
 Review comment:
   Thanks!


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu opened a new issue #10092: No "full" pooling convention support with MKL-DNN

2018-03-13 Thread GitBox
marcoabreu opened a new issue #10092: No "full" pooling convention support with 
MKL-DNN
URL: https://github.com/apache/incubator-mxnet/issues/10092
 
 
   I'm kind of lacking context here, but I'd like to track this issue. More 
details are available at https://github.com/apache/incubator-mxnet/pull/10021
   
   @ashokei would you mind summarizing the problem?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on issue #10021: [MXNET-33] SSD example not working with mkl-dnn

2018-03-13 Thread GitBox
marcoabreu commented on issue #10021: [MXNET-33] SSD example not working with 
mkl-dnn
URL: https://github.com/apache/incubator-mxnet/pull/10021#issuecomment-372864199
 
 
   That's not an issue, we're already testing a variety of models and the 
bigger diversity, the better. We can re-visit this decision later on and reduce 
the test size if required. For now, it would be good to get a test since we 
would like to re-enable pooling for MKL-DNN at a later point in time - this 
test would give us a tool to verify that it's actually working again. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174324064
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   What's being tested is the fork()


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] eric-haibin-lin closed issue #10084: which optimizer to support sparse update except adam, ftrl, sgd?

2018-03-13 Thread GitBox
eric-haibin-lin closed issue #10084: which optimizer to support sparse update 
except adam, ftrl, sgd?
URL: https://github.com/apache/incubator-mxnet/issues/10084
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] eric-haibin-lin commented on issue #10084: which optimizer to support sparse update except adam, ftrl, sgd?

2018-03-13 Thread GitBox
eric-haibin-lin commented on issue #10084: which optimizer to support sparse 
update except adam, ftrl, sgd?
URL: 
https://github.com/apache/incubator-mxnet/issues/10084#issuecomment-372863154
 
 
   
https://mxnet.incubator.apache.org/versions/master/api/python/ndarray/sparse.html#updater
 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] ashokei commented on issue #10021: [MXNET-33] SSD example not working with mkl-dnn

2018-03-13 Thread GitBox
ashokei commented on issue #10021: [MXNET-33] SSD example not working with 
mkl-dnn
URL: https://github.com/apache/incubator-mxnet/pull/10021#issuecomment-372861771
 
 
   @marcoabreu this issue only happens inside a particular model (SSD 
VGG16-reduced), i clarified in title/description. I'm not sure a special 
unittest just for this specific model is appropriate. I am not able to 
reproduce this issue on separately. please let me know if any other 
suggestions/feedback, thanks!.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #9963: [MXNET-34] Onnx Module 
to import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174321757
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_model.py
 ##
 @@ -0,0 +1,46 @@
+# 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.
+
+# coding: utf-8
+"""import function"""
+# pylint: disable=no-member
+
+from .import_onnx import GraphProto
+
+def import_model(model_file):
+"""Imports the supplied ONNX model file into MXNet symbol and parameters.
+:parameters model_file
+--
+model_file : ONNX model file name
+
+:returns (sym, params)
 
 Review comment:
   The rendered page is available at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-9963/54/index.html 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174321395
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   Ah I see, thanks


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174320555
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   @marcoabreu In fact, the current design of DataLoader requires the user to 
correctly define the batchify function in order to use the multi-process 
feature. We need to revise the interface.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] anirudhacharya commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
anirudhacharya commented on a change in pull request #9963: [MXNET-34] Onnx 
Module to import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174319252
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_helper.py
 ##
 @@ -0,0 +1,105 @@
+# 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.
+
+# coding: utf-8
+# pylint: disable=invalid-name
+"""Operator attributes conversion"""
+from .op_translations import identity, random_uniform, random_normal
+from .op_translations import add, subtract, multiply, divide, absolute, 
negative, add_n
+from .op_translations import tanh
+from .op_translations import ceil, floor
+from .op_translations import concat
+from .op_translations import leaky_relu, _elu, _prelu, softmax, fully_connected
+from .op_translations import global_avgpooling, global_maxpooling, linalg_gemm
+from .op_translations import sigmoid, pad, relu, matrix_multiplication, 
batch_norm
+from .op_translations import dropout, local_response_norm, conv, deconv
 
 Review comment:
   it is not as per mxnet convention to do 
   ```python
   from op_translations import *
   ```
   It was an earlier comment by one of the reviewers/committers.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] anirudhacharya commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
anirudhacharya commented on a change in pull request #9963: [MXNET-34] Onnx 
Module to import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174318632
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_helper.py
 ##
 @@ -0,0 +1,105 @@
+# 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.
+
+# coding: utf-8
+# pylint: disable=invalid-name
+"""Operator attributes conversion"""
+from .op_translations import identity, random_uniform, random_normal
+from .op_translations import add, subtract, multiply, divide, absolute, 
negative, add_n
+from .op_translations import tanh
+from .op_translations import ceil, floor
+from .op_translations import concat
+from .op_translations import leaky_relu, _elu, _prelu, softmax, fully_connected
+from .op_translations import global_avgpooling, global_maxpooling, linalg_gemm
+from .op_translations import sigmoid, pad, relu, matrix_multiplication, 
batch_norm
+from .op_translations import dropout, local_response_norm, conv, deconv
+from .op_translations import reshape, cast, split, _slice, transpose, squeeze
+from .op_translations import reciprocal, squareroot, power, exponent, _log
+from .op_translations import reduce_max, reduce_mean, reduce_min, reduce_sum
+from .op_translations import reduce_prod, avg_pooling, max_pooling
+from .op_translations import argmax, argmin, maximum, minimum
+
+# convert_map defines maps of ONNX operator names to converter 
functor(callable)
 
 Review comment:
   its a typo in the comment. I will fix it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to 
import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174317953
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_helper.py
 ##
 @@ -0,0 +1,105 @@
+# 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.
+
+# coding: utf-8
+# pylint: disable=invalid-name
+"""Operator attributes conversion"""
+from .op_translations import identity, random_uniform, random_normal
+from .op_translations import add, subtract, multiply, divide, absolute, 
negative, add_n
+from .op_translations import tanh
+from .op_translations import ceil, floor
+from .op_translations import concat
+from .op_translations import leaky_relu, _elu, _prelu, softmax, fully_connected
+from .op_translations import global_avgpooling, global_maxpooling, linalg_gemm
+from .op_translations import sigmoid, pad, relu, matrix_multiplication, 
batch_norm
+from .op_translations import dropout, local_response_norm, conv, deconv
 
 Review comment:
   why not import all functions from .op_translations instead of specifying 
each function here? 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to 
import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174316464
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_model.py
 ##
 @@ -0,0 +1,46 @@
+# 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.
+
+# coding: utf-8
+"""import function"""
+# pylint: disable=no-member
+
+from .import_onnx import GraphProto
+
+def import_model(model_file):
+"""Imports the supplied ONNX model file into MXNet symbol and parameters.
+:parameters model_file
+--
+model_file : ONNX model file name
+
+:returns (sym, params)
+---
+sym : mx.symbol
+Compatible mxnet symbol
+params : dict of str to mx.ndarray
+Dict of converted parameters stored in mx.ndarray format
+"""
+graph = GraphProto()
+
+# loads model file and returns ONNX protobuf object
+try:
+import onnx
+except ImportError:
+raise ImportError("Onnx and protobuf need to be installed")
 
 Review comment:
   Can we also add a link to onnx installation here while throwing this error?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to 
import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174315641
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_helper.py
 ##
 @@ -0,0 +1,105 @@
+# 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.
+
+# coding: utf-8
+# pylint: disable=invalid-name
+"""Operator attributes conversion"""
+from .op_translations import identity, random_uniform, random_normal
+from .op_translations import add, subtract, multiply, divide, absolute, 
negative, add_n
+from .op_translations import tanh
+from .op_translations import ceil, floor
+from .op_translations import concat
+from .op_translations import leaky_relu, _elu, _prelu, softmax, fully_connected
+from .op_translations import global_avgpooling, global_maxpooling, linalg_gemm
+from .op_translations import sigmoid, pad, relu, matrix_multiplication, 
batch_norm
+from .op_translations import dropout, local_response_norm, conv, deconv
+from .op_translations import reshape, cast, split, _slice, transpose, squeeze
+from .op_translations import reciprocal, squareroot, power, exponent, _log
+from .op_translations import reduce_max, reduce_mean, reduce_min, reduce_sum
+from .op_translations import reduce_prod, avg_pooling, max_pooling
+from .op_translations import argmax, argmin, maximum, minimum
+
+# convert_map defines maps of ONNX operator names to converter 
functor(callable)
 
 Review comment:
   converter functor? typo?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-13 Thread GitBox
Roshrini commented on a change in pull request #9963: [MXNET-34] Onnx Module to 
import onnx models into mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9963#discussion_r174316786
 
 

 ##
 File path: python/mxnet/contrib/onnx/_import/import_model.py
 ##
 @@ -0,0 +1,46 @@
+# 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.
+
+# coding: utf-8
+"""import function"""
+# pylint: disable=no-member
+
+from .import_onnx import GraphProto
+
+def import_model(model_file):
+"""Imports the supplied ONNX model file into MXNet symbol and parameters.
+:parameters model_file
+--
+model_file : ONNX model file name
+
+:returns (sym, params)
 
 Review comment:
   Check for doc rendering. Will be helpful if we decide to add these API docs 
on the website later.
   Follow the same convention throughout


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10089: enable all activations 
in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#discussion_r174304740
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_act.cc
 ##
 @@ -45,11 +45,9 @@ namespace op {
 bool SupportMKLDNNAct(const ActivationParam& param) {
   // We only enable ReLU for now. It seems other activations have some 
precision
 
 Review comment:
   The comment explains why the operators have been disabled. This PR 
re-enables them and thus the comment is obsolete


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174314312
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   Is the logic here that it loads the Data multithreaded into CPU before it 
gets passed down further (cpu/gpu context)?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174313685
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   My thought was that the internals of the DataLoader are being tested here 
and that they are independent of the context. Am I mistaken here?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] reminisce opened a new pull request #10091: Add quadratic op for the tutorial of adding ops in backend

2018-03-13 Thread GitBox
reminisce opened a new pull request #10091: Add quadratic op for the tutorial 
of adding ops in backend
URL: https://github.com/apache/incubator-mxnet/pull/10091
 
 
   ## Description ##
   The operator `quadratic` is used as an example of this 
[tutorial](https://mxnet.incubator.apache.org/faq/add_op_in_backend.html), 
while its implementation is kept in my personal repo. Now move it to the public 
repo and will change the corresponding links in the tutorial to the new ones 
after this PR is merged.
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [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
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   @eric-haibin-lin 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174312690
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   @sxjscience sure, go ahead and merge. This seems pretty critical


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] rahul003 commented on issue #8509: test_operator_gpu.py:test_batchnorm_with_type robustness

2018-03-13 Thread GitBox
rahul003 commented on issue #8509: 
test_operator_gpu.py:test_batchnorm_with_type robustness
URL: 
https://github.com/apache/incubator-mxnet/issues/8509#issuecomment-372849471
 
 
   That looks like something we can look into if similar issues persist. But 
for now, we believe this is because of float16 precision. 
   
   @eric-haibin-lin Could you add the label Exploration


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] rahul003 commented on issue #9916: precision bug in batchnorm.

2018-03-13 Thread GitBox
rahul003 commented on issue #9916: precision bug in batchnorm.
URL: 
https://github.com/apache/incubator-mxnet/issues/9916#issuecomment-372847814
 
 
   Relevant suggestion https://github.com/apache/incubator-mxnet/issues/8509


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] rahul003 commented on issue #9916: precision bug in batchnorm.

2018-03-13 Thread GitBox
rahul003 commented on issue #9916: precision bug in batchnorm.
URL: 
https://github.com/apache/incubator-mxnet/issues/9916#issuecomment-372847814
 
 
   Relevant comment https://github.com/apache/incubator-mxnet/issues/8509


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] rahul003 commented on issue #8529: What is the functionality of OrderMutation

2018-03-13 Thread GitBox
rahul003 commented on issue #8529: What is the functionality of OrderMutation
URL: 
https://github.com/apache/incubator-mxnet/issues/8529#issuecomment-372847594
 
 
   @eric-haibin-lin please add the labels Doc, Question


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174309509
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   That change was suggested by Eric, so please take that up with him


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-13 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174309219
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   This is a breaking change. The previous API should not be removed. At least 
an alias should be kept. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on issue #10085: Ordering operators do not support kNullOp

2018-03-13 Thread GitBox
sxjscience commented on issue #10085: Ordering operators do not support kNullOp
URL: 
https://github.com/apache/incubator-mxnet/issues/10085#issuecomment-372845417
 
 
   Sorry that I'm too busy with other stuffs. Can anyone help solve the bug? If 
not, I will solve it later.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] eric-haibin-lin commented on a change in pull request #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2018-03-13 Thread GitBox
eric-haibin-lin commented on a change in pull request #8972: Profiling 
enhancements, python API, vtune and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#discussion_r174309219
 
 

 ##
 File path: python/mxnet/profiler.py
 ##
 @@ -35,13 +68,16 @@ def profiler_set_config(mode='symbolic', 
filename='profile.json'):
 filename : string, optional
 The name of output trace file. Defaults to 'profile.json'.
 """
-mode2int = {'symbolic': 0, 'all': 1}
-check_call(_LIB.MXSetProfilerConfig(
-ctypes.c_int(mode2int[mode]),
-c_str(filename)))
+warnings.warn('profiler.profiler_set_config() is deprecated. ' \
+  'Please use profiler.set_config() instead')
+keys = c_str_array([key for key in ["profile_" + mode, "filename"]])
+values = c_str_array([str(val) for val in [True, filename]])
+assert len(keys) == len(values)
+check_call(_LIB.MXSetProfilerConfig(len(keys), keys, values))
+
 
-def profiler_set_state(state='stop'):
 
 Review comment:
   This is a breaking change. The previous API should not be renamed. At least 
an alias should be kept. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174308148
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Failed to use `forkserver`. I'll continue working on something else.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174307840
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   I meant Marco's comment, I didn't see yours yet at the time.  Since they are 
foked, any memory allocated after the fork would need to be cpu_shared, so it 
makes sense to have the context cpu_shared.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174307840
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   I meant Marco's comment, I didn't see yours yet at the time.  Since they are 
foked, any memory allocated after the fork would need to be cpu_shared.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174307538
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Looks like someone tried to fix it once: 
https://patchwork.ozlabs.org/patch/319827/


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174307193
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(x_lens, ctx=context.Context('cpu_shared', 0))) \
+if labels is None else (
+nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(x_lens, ctx=context.Context('cpu_shared', 0)),
+nd.array(labels, dtype=labels.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(y_lens, ctx=context.Context('cpu_shared', 0)))
+
+
+data = Dummy(True)
+loader = DataLoader(data, batch_size=40, batchify_fn=data.batchify, 
num_workers=2)
 
 Review comment:
   ok


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
Jerryzcn commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174306619
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   when I trained on our dataset, the stack trace point to 
cpu_shared_storage_manager.h:178.
   However, it might not be, need to be tested.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174306094
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   Why would you think that?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] Jerryzcn commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
Jerryzcn commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304900
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   might be related to 'cpu_shared'.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304792
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   ```cpp
   /*
   Reset the library so execution in the child starts "all over again" with
   clean data structures in initial states.  Don't worry about freeing 
memory
   allocated by parent, just abandon it to be safe.
   */
   static void
   __kmp_atfork_child (void)
   {
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10089: enable all activations in MKLDNN.

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10089: enable all activations 
in MKLDNN.
URL: https://github.com/apache/incubator-mxnet/pull/10089#discussion_r174304740
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_act.cc
 ##
 @@ -45,11 +45,9 @@ namespace op {
 bool SupportMKLDNNAct(const ActivationParam& param) {
   // We only enable ReLU for now. It seems other activations have some 
precision
 
 Review comment:
   Because the comment explains why the operators have been disabled. This PR 
re-enables them and thus the comment is obsolete


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304476
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Intel OMP at fork, sets all its init vars to uninitialized, so that it 
recreates its state in the new fork:
   
   https://github.com/pmodels/bolt/blob/master/runtime/src/z_Linux_util.c#L1536


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304476
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Intel OMP at fork, sets all its init vars to uninitialized, so that I 
suppose it recreates its state in the new fork:
   
   https://github.com/pmodels/bolt/blob/master/runtime/src/z_Linux_util.c#L1536


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304481
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(x_lens, ctx=context.Context('cpu_shared', 0))) \
+if labels is None else (
+nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(x_lens, ctx=context.Context('cpu_shared', 0)),
+nd.array(labels, dtype=labels.dtype, 
ctx=context.Context('cpu_shared', 0)),
+nd.array(y_lens, ctx=context.Context('cpu_shared', 0)))
+
+
+data = Dummy(True)
+loader = DataLoader(data, batch_size=40, batchify_fn=data.batchify, 
num_workers=2)
 
 Review comment:
   Could you add a comment that explains that we basically just expect this to 
pass?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
marcoabreu commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174304377
 
 

 ##
 File path: tests/python/unittest/test_gluon_data.py
 ##
 @@ -112,6 +117,76 @@ def test_multi_worker():
 for i, batch in enumerate(loader):
 assert (batch.asnumpy() == i).all()
 
+@with_seed()
+def test_multi_worker_data_loader():
+class Dummy(Dataset):
+def __init__(self, random_shape):
+self.random_shape = random_shape
+
+def __getitem__(self, idx):
+key = idx
+if self.random_shape:
+out = np.random.uniform(size=(random.randint(1000, 1100), 40))
+labels = np.random.uniform(size=(random.randint(10, 15)))
+else:
+out = np.random.uniform(size=(1000, 40))
+labels = np.random.uniform(size=(10))
+return key, out, labels
+
+def __len__(self):
+return 50
+
+def batchify(self, data):
+"""
+Collate data into batch. Use shared memory for stacking.
+
+:param data: a list of array, with layout of 'NTC'.
+:return either x  and x's unpadded lengths, or x, x's unpadded 
lengths, y and y's unpadded lengths
+if labels are not supplied.
+"""
+
+# input layout is NTC
+keys, inputs, labels = [item[0] for item in data], [item[1] for 
item in data], \
+   [item[2] for item in data]
+
+if len(data) > 1:
+max_data_len = max([seq.shape[0] for seq in inputs])
+max_labels_len = 0 if not labels else max([seq.shape[0] for 
seq in labels])
+else:
+max_data_len = inputs[0].shape[0]
+max_labels_len = 0 if not labels else labels[0].shape[0]
+
+x_lens = [item.shape[0] for item in inputs]
+y_lens = [item.shape[0] for item in labels]
+
+for i, seq in enumerate(inputs):
+pad_len = max_data_len - seq.shape[0]
+inputs[i] = np.pad(seq, ((0, pad_len), (0, 0)), 'constant', 
constant_values=0)
+labels[i] = np.pad(labels[i], (0, max_labels_len - 
labels[i].shape[0]),
+   'constant', constant_values=-1)
+
+inputs = np.asarray(inputs, dtype=np.float32)
+if labels is not None:
+labels = np.asarray(labels, dtype=np.float32)
+inputs = inputs.transpose((1, 0, 2))
+labels = labels.transpose((1, 0))
+
+return (nd.array(inputs, dtype=inputs.dtype, 
ctx=context.Context('cpu_shared', 0)),
 
 Review comment:
   I guess the context is not really important here, right?


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174303894
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   It suggests start the multiprocessing using `forkserver` 
(https://docs.python.org/3/library/multiprocessing.html#multiprocessing.set_start_method).
 I'm trying this keyword.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174303574
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Ha! Nice find! That's exactly it.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174303261
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Using the keyword I find this link: 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58378


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174300231
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   I think the fork doesn't play nicely with libgomp in this codepath because 
it works fine when linked against mkl, which uses libiomp5.  Or if you build 
with cmake, which builds and links against Intel omp (in 3rdparty), it works 
fine even without MKL enabled.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174300231
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   I think the fork doesn't play nicely with libgomp in this codepath because 
it works fine when linked against mkl, which uses libiomp5.  Or if you build 
with cmake, which builds and links against Intel omp (in 3rdparty), it works 
fine.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174300231
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   I think the fork doesn't play nicely with libgomp in this codepath because 
it works fine when linked against mkl, which uses libiomp5.  Or if built with 
cmake, which builds and links against Intel omp (in 3rdparty), it works fine.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174300231
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   I think the fork doesn't play nicely with libgomp in this codepath because 
it works fine when linked against mkl, which uses libiomp.  Or if built with 
cmake, which builds and links against Intel omp (in 3rdparty), it works fine.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174296439
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Yes, I think we can revert first and find the cause later. What do you think 
@marcoabreu . This error is really critical as the DataLoader is very common 
among users. No one will use Gluon if the DataLoader has a bug.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174296439
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Yes, I think we can revert first and find the cause later. What do you think 
@marcoabreu . This error is really critical as the DataLoader is very common 
among users. No one will use MXNet if the DataLoader has a bug.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
sxjscience commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174296439
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   Yes, I think we can revert first and find the cause later. What do you think 
@marcoabreu . This error is really critical as the DataLoader is really common 
among users.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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] cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to pre-profile-changes copy code

2018-03-13 Thread GitBox
cjolivier01 commented on a change in pull request #10090: [MXNET-86] Revert to 
pre-profile-changes copy code
URL: https://github.com/apache/incubator-mxnet/pull/10090#discussion_r174295804
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -26,35 +26,24 @@
 #include "./ndarray_function.h"
 #include "./ndarray_function-inl.h"
 #include "../common/utils.h"
-#include "../operator/mxnet_op.h"
 
 namespace mxnet {
 namespace ndarray {
 template<>
 void Copy(const TBlob , TBlob *to,
 Context from_ctx, Context to_ctx,
 RunContext ctx) {
-  using namespace mxnet::op;
   MSHADOW_TYPE_SWITCH(to->type_flag_, DType, {
 if (to->type_flag_ == from.type_flag_) {
-  TBlob dest = to->FlatTo1D();
-  TBlob src = from.FlatTo1D();
-  const size_t size = src.Size();
-  if (dest.CheckContiguous() && src.CheckContiguous() && size >= 2 /* 
non-trivial size */) {
-CHECK_EQ(dest.shape_, src.shape_)
-  << "Copy:shape mismatch:" << dest.shape_ << " vs " << src.shape_;
-  mxnet_op::Kernel, cpu>::Launch(
-ctx.get_stream(), src.Size(), dest.dptr(), 
src.dptr());
 
 Review comment:
   It does get stuck in the kernel launch code for whatever reason.


This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


  1   2   3   >