[GitHub] reminisce commented on issue #9997: Flaky test: test_sparse_embedding

2018-03-08 Thread GitBox
reminisce commented on issue #9997: Flaky test: test_sparse_embedding
URL: 
https://github.com/apache/incubator-mxnet/issues/9997#issuecomment-371739006
 
 
   The `atol` cannot be zero here. When comparing two values, the following 
inequality is checked:
   `|a-b| < atol + b * rtol`.
   In this case, `a` and `b` are very close to zero, and `atol=0` makes the 
inequality unsatisfied.
   Suggest set `atol=1e-4` or `1e-3`.


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 commented on issue #9916: precision bug in batchnorm.

2018-03-08 Thread GitBox
reminisce commented on issue #9916: precision bug in batchnorm.
URL: 
https://github.com/apache/incubator-mxnet/issues/9916#issuecomment-371736378
 
 
   After some investigation, I think it's due to the low precision that FP16 
has.
   
   When doing batch norm backward pass, gradients of `gamma` and `beta` are 
accumulated on a fixed channel with the forward output as input data. In this 
case, 1000 values are added together. 
   
   I measure the two kinds of data difference between batchnorm op of fp64 and 
fp16: 
   1. input data: ~0.575 total difference 
   2. output data: ~3.879 total difference 
   
   The data is obtained from the ndarrays dumped from the failing case. When 
doing backward pass, for each channel with 1000 addition operations, it could 
result in roughly 1.9*0.6=1.14 difference between fp16 and fp64 for the 
gradient of gamma. 
   
   We can do two things to make the test stable and better:
   1. Reduce the size of input data in the consistency test so that not too 
much rounding errors are accumulated. There is no need to test data with shape 
as big as (10, 2, 10, 10) here.
   2. In the function `check_consistency`, initialize the `arg_params` and 
`aux_params` with the data type of the lowest precision in the `ctx_list` so 
that less data type casting errors are introduced while initializing executors.
   
   I have tried the first approach with shape equal to (2, 2, 3, 3) and repeat 
the test more than 1000 times without failure.


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 #9977: Cpu lstm inference

2018-03-08 Thread GitBox
Jerryzcn commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173381025
 
 

 ##
 File path: tests/python/unittest/test_gluon_rnn.py
 ##
 @@ -67,6 +67,22 @@ def test_lstm_forget_bias():
forget_bias * np.ones(100, ), np.zeros((2 * 
100,))])
 assert_allclose(mod.get_params()[0][bias_argument].asnumpy(), 
expected_bias)
 
+def test_lstm_cpu_inference():
+# should behave the same as lstm cell
+atol = 1e-6
+x = mx.nd.ones(shape=(2, 2, 2))
+model = mx.gluon.nn.Sequential()
+with model.name_scope():
+model.add(mx.gluon.rnn.LSTM(2, num_layers=6, bidirectional=True))
+model.initialize(mx.init.One())
 
 Review comment:
   will it break CPU tests? It might be too much an effort


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 #9977: Cpu lstm inference

2018-03-08 Thread GitBox
Jerryzcn commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173381025
 
 

 ##
 File path: tests/python/unittest/test_gluon_rnn.py
 ##
 @@ -67,6 +67,22 @@ def test_lstm_forget_bias():
forget_bias * np.ones(100, ), np.zeros((2 * 
100,))])
 assert_allclose(mod.get_params()[0][bias_argument].asnumpy(), 
expected_bias)
 
+def test_lstm_cpu_inference():
+# should behave the same as lstm cell
+atol = 1e-6
+x = mx.nd.ones(shape=(2, 2, 2))
+model = mx.gluon.nn.Sequential()
+with model.name_scope():
+model.add(mx.gluon.rnn.LSTM(2, num_layers=6, bidirectional=True))
+model.initialize(mx.init.One())
 
 Review comment:
   will it break CPU tests?


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] EternalSaga opened a new issue #10049: Building MxNet on Win10 with CPP package, CUDA9 and MKL 2018

2018-03-08 Thread GitBox
EternalSaga opened a new issue #10049: Building MxNet on Win10 with CPP 
package, CUDA9 and MKL 2018
URL: https://github.com/apache/incubator-mxnet/issues/10049
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues and bug reports. For non-technical 
issues and feature requests, feel free to present the information in what you 
believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at 
https://discuss.mxnet.io 
   
   ## Description
   I'm trying to build mxnet on win10 with cpp package. After some hard 
efforts, I built the libmxnet.dll successfully. But I cannot generate the op.h 
file through the python script OpWrapperGenerator.py.
   Here is the error message. Perhaps it is resulted by the MKL path, but I 
have no idea how to fix it.
   python OpWrapperGenerator.py D:/Program
   mingAndStudy/cpp library/mxnet/build/Release/libmxnet.dll
   Traceback (most recent call last):
 File "OpWrapperGenerator.py", line 425, in 
   raise(e)
 File "OpWrapperGenerator.py", line 419, in 
   f.write(patternStr % ParseAllOps())
 File "OpWrapperGenerator.py", line 314, in ParseAllOps
   cdll.libmxnet = cdll.LoadLibrary(sys.argv[1])
 File "C:\Program Files\Python36\lib\ctypes\__init__.py", line 426, in 
LoadLibrary
   return self._dlltype(name)
 File "C:\Program Files\Python36\lib\ctypes\__init__.py", line 348, in 
__init__
   self._handle = _dlopen(self._name, mode)
   OSError: [WinError 126] ?
   
   ## Environment info (Required)
   
   ```
   What to do:
   1. Download the diagnosis script from 
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   
   2. Run the script using `python diagnose.py` and paste its output here.
   
   ```
   
   Package used (Python/R/Scala/Julia):
   (I'm using ...)
   I want to use mxnet through C++.
   
   ## Build info (Required if built from source)
   
![mxnetbuilt](https://user-images.githubusercontent.com/15174504/37193376-838efed8-23a4-11e8-96bd-7bd592041823.PNG)
   
   Compiler (gcc/clang/mingw/visual studio):
   visual studio
   MXNet commit hash:
   (Paste the output of `git rev-parse HEAD` here.)
   
   Build config:
   (Paste the content of config.mk, or the build command.)
   
   ## Error Message:
   (Paste the complete error message, including stack trace.)
   
   ## Minimum reproducible example
   (If you are using your own code, please provide a short script that 
reproduces the error. Otherwise, please provide link to the existing example.)
   
   ## Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1.
   2.
   
   ## What have you tried to solve it?
   
   1.
   2.
   


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 #9977: Cpu lstm inference

2018-03-08 Thread GitBox
szha commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173372031
 
 

 ##
 File path: src/operator/rnn-inl.h
 ##
 @@ -144,15 +149,223 @@ class RNNOp : public Operator {
 const std::vector ,
 const std::vector _grad,
 const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
 // TODO(sbodenstein): add MShadow implementation
   }
 
  private:
   RNNParam param_;
 };  // class RNNOp
 
+template
+class RNNOp : public Operator {
+ public:
+  explicit RNNOp(RNNParam param) {
+this->param_ = param;
+// RNN Mode
+param_.lstm_q_ = false;
+switch (param_.mode) {
+  case rnn_enum::kLstm:
+param_.lstm_q_ = true;
+break;
+  default:
+LOG(FATAL) << "only LSTM is implmented on CPU";
+}
+  }
+
+  virtual void Forward(const OpContext ,
+   const std::vector _data,
+   const std::vector ,
+   const std::vector _data,
+   const std::vector _args) {
+// Layout TNC
+
+size_t in_expected = param_.lstm_q_ ? 4 : 3;
+size_t out_expected = param_.lstm_q_ ? 3 : 2;
+
+if (!param_.state_outputs)
+  LOG(FATAL) << "no state outputs is currently not supported for cpu.";
+
+CHECK_EQ(req[rnn_enum::kOut], kWriteTo);
+CHECK_EQ(in_data.size(), in_expected);
+CHECK_EQ(out_data.size(), out_expected);
+
+mshadow::Stream *s = ctx.get_stream();
+// get input + output tensors
+// w layout i2h_w, h2h_w, i2h_b, h2h_b
+Tensor x =
+in_data[rnn_enum::kData].get(s);  // TNC
+Tensor w = in_data[rnn_enum::kParams].get(s);
+Tensor hx =
+in_data[rnn_enum::kState].get(s);  // LNC
+Tensor y =
+out_data[rnn_enum::kOut].get(s);  // TNC
+int64_t seq_len = x.shape_[0];
+int64_t num_layers = hx.shape_[0];
+int64_t batch_size = x.shape_[1];
+int64_t h_channel = hx.shape_[2];
+int64_t in_channel = x.shape_[2];
+Tensor x_flatten = in_data[rnn_enum::kData]
+  .get_with_shape(
+  mshadow::Shape2(seq_len * batch_size, in_channel), s);  // (T*N)C
+Tensor y_flatten = out_data[rnn_enum::kOut]
+  .get_with_shape(
+  mshadow::Shape2(
+  y.shape_[0] * y.shape_[1], y.shape_[2]), s);  // (T*N)C
+
+CHECK_EQ(x.CheckContiguous(), true);
+CHECK_EQ(w.CheckContiguous(), true);
+CHECK_EQ(hx.CheckContiguous(), true);
+CHECK_EQ(y.CheckContiguous(), true);
 
 Review comment:
   CHECK(x.CheckContiguous());


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 #9921: [DISCUSSION] module.contrib.SparseModule API

2018-03-08 Thread GitBox
eric-haibin-lin commented on issue #9921: [DISCUSSION] 
module.contrib.SparseModule API
URL: 
https://github.com/apache/incubator-mxnet/issues/9921#issuecomment-371722591
 
 
   @zheng-da Thanks for the comments! For the first point, however, the 
graph_executor/operators are not aware of the existence of KVStore at all, nor 
should it be. That will make the backend interface really messy and hard to 
maintain. 
   
   For the second part, I don't quite understand what the "array lookup table" 
does. How is it different from a hash table? Also, I don't think any existing 
sparse operator uses hash table like `std::unordered_map` yet.  Could you 
elaborate? Are you suggesting keep a copy of the weight matrix in one NDArray 
`X`, and other NDArray `Y` just use this look up table to access the memory of 
`X`? I thought of this before and it seems to be very hard to maintain, 
encourage memory leak/corruption and race conditions.. 


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 #9977: Cpu lstm inference

2018-03-08 Thread GitBox
szha commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173371568
 
 

 ##
 File path: tests/python/unittest/test_gluon_rnn.py
 ##
 @@ -67,6 +67,22 @@ def test_lstm_forget_bias():
forget_bias * np.ones(100, ), np.zeros((2 * 
100,))])
 assert_allclose(mod.get_params()[0][bias_argument].asnumpy(), 
expected_bias)
 
+def test_lstm_cpu_inference():
+# should behave the same as lstm cell
+atol = 1e-6
+x = mx.nd.ones(shape=(2, 2, 2))
+model = mx.gluon.nn.Sequential()
+with model.name_scope():
+model.add(mx.gluon.rnn.LSTM(2, num_layers=6, bidirectional=True))
+model.initialize(mx.init.One())
 
 Review comment:
   Could you also test the consistency between cpu and gpu, with same random 
weights and random inputs?


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] Sherry-Zhang commented on a change in pull request #9977: Cpu lstm inference

2018-03-08 Thread GitBox
Sherry-Zhang commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173371417
 
 

 ##
 File path: src/operator/rnn-inl.h
 ##
 @@ -114,7 +120,8 @@ struct RNNParam : public dmlc::Parameter {
 
 DMLC_DECLARE_FIELD(p).set_default(0.)
 .set_range(0, 1)
-.describe("Dropout probability, fraction of the input that gets dropped 
out at training time");
+.describe("Dropout probability, fraction of the input that gets dropped"
+"out at training time");
 
 Review comment:
   pkeep_, lstm_q_ are used in cudnn_rnn-inl.h


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
szha commented on a change in pull request #9995: [WIP] CI docker revamp; Add 
Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173371249
 
 

 ##
 File path: python/mxnet/gluon/data/dataloader.py
 ##
 @@ -214,6 +214,7 @@ def __iter__(self):
 worker.start()
 workers.append(worker)
 
+idx = 0
 
 Review comment:
   ?


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
szha commented on a change in pull request #9995: [WIP] CI docker revamp; Add 
Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173370939
 
 

 ##
 File path: ci/docker/install/arm64_openblas.sh
 ##
 @@ -0,0 +1,35 @@
+#!/bin/bash
+
+# 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.
+
+# build and install are separated so changes to build don't invalidate
+# the whole docker cache for the image
+
+set -ex
+pushd .
+wget -nv https://api.github.com/repos/xianyi/OpenBLAS/git/refs/heads/master -O 
openblas_version.json
+echo "Using openblas:"
+cat openblas_version.json
+git clone https://github.com/xianyi/OpenBLAS.git
+cd OpenBLAS
+make -j$(nproc) TARGET=ARMV8
+make install
+ln -s /opt/OpenBLAS/lib/libopenblas.so /usr/lib/libopenblas.so
+ln -s /opt/OpenBLAS/lib/libopenblas.a /usr/lib/libopenblas.a
+ln -s /opt/OpenBLAS/lib/libopenblas.a /usr/lib/liblapack.a
 
 Review comment:
   `make PREFIX=path install` can help specify the place to put these files.


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] TaoLv commented on a change in pull request #9977: Cpu lstm inference

2018-03-08 Thread GitBox
TaoLv commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173370569
 
 

 ##
 File path: src/operator/rnn-inl.h
 ##
 @@ -144,15 +149,223 @@ class RNNOp : public Operator {
 const std::vector ,
 const std::vector _grad,
 const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
 // TODO(sbodenstein): add MShadow implementation
   }
 
  private:
   RNNParam param_;
 };  // class RNNOp
 
+template
+class RNNOp : public Operator {
+ public:
+  explicit RNNOp(RNNParam param) {
+this->param_ = param;
+// RNN Mode
+param_.lstm_q_ = false;
+switch (param_.mode) {
+  case rnn_enum::kLstm:
+param_.lstm_q_ = true;
+break;
+  default:
+LOG(FATAL) << "only LSTM is implmented on CPU";
+}
+  }
+
+  virtual void Forward(const OpContext ,
+   const std::vector _data,
+   const std::vector ,
+   const std::vector _data,
+   const std::vector _args) {
+// Layout TNC
+
+size_t in_expected = param_.lstm_q_ ? 4 : 3;
+size_t out_expected = param_.lstm_q_ ? 3 : 2;
+
+if (!param_.state_outputs)
+  LOG(FATAL) << "no state outputs is currently not supported for cpu.";
+
+CHECK_EQ(req[rnn_enum::kOut], kWriteTo);
+CHECK_EQ(in_data.size(), in_expected);
+CHECK_EQ(out_data.size(), out_expected);
+
+mshadow::Stream *s = ctx.get_stream();
+// get input + output tensors
+// w layout i2h_w, h2h_w, i2h_b, h2h_b
+Tensor x =
+in_data[rnn_enum::kData].get(s);  // TNC
+Tensor w = in_data[rnn_enum::kParams].get(s);
+Tensor hx =
+in_data[rnn_enum::kState].get(s);  // LNC
+Tensor y =
+out_data[rnn_enum::kOut].get(s);  // TNC
+int64_t seq_len = x.shape_[0];
+int64_t num_layers = hx.shape_[0];
+int64_t batch_size = x.shape_[1];
+int64_t h_channel = hx.shape_[2];
+int64_t in_channel = x.shape_[2];
+Tensor x_flatten = in_data[rnn_enum::kData]
+  .get_with_shape(
+  mshadow::Shape2(seq_len * batch_size, in_channel), s);  // (T*N)C
+Tensor y_flatten = out_data[rnn_enum::kOut]
+  .get_with_shape(
+  mshadow::Shape2(
+  y.shape_[0] * y.shape_[1], y.shape_[2]), s);  // (T*N)C
+
+CHECK_EQ(x.CheckContiguous(), true);
+CHECK_EQ(w.CheckContiguous(), true);
+CHECK_EQ(hx.CheckContiguous(), true);
+CHECK_EQ(y.CheckContiguous(), true);
+
+CHECK(!ctx.is_train) << "only inference mode is available"
+  "for cpu at the moment.";
 
 Review comment:
   How about check this at the front of this function?


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] TaoLv commented on a change in pull request #9977: Cpu lstm inference

2018-03-08 Thread GitBox
TaoLv commented on a change in pull request #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#discussion_r173370326
 
 

 ##
 File path: src/operator/rnn-inl.h
 ##
 @@ -114,7 +120,8 @@ struct RNNParam : public dmlc::Parameter {
 
 DMLC_DECLARE_FIELD(p).set_default(0.)
 .set_range(0, 1)
-.describe("Dropout probability, fraction of the input that gets dropped 
out at training time");
+.describe("Dropout probability, fraction of the input that gets dropped"
+"out at training time");
 
 Review comment:
   Remove this change. Length of this line is less than 100.
   BTW, why there are still some parameters don't have their descriptions, like 
pkeep_, lstm_q_?


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 #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

2018-03-08 Thread GitBox
eric-haibin-lin commented on a change in pull request #9947: [WIP] Performance 
optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r173369215
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
 mxnet_op::Kernel::Launch(s, num_threads,
   
ret->dptr());
   }
-  num_threads = mxnet_op::get_num_threads(ret->shape_[0]);
-  dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+  num_threads = ret->shape_[0];
   if (trans_lhs) {
 LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, 
rsp) = dns yet";
   } else {
+const RType* row_idx_ptr = row_idx_r.dptr();
+std::unordered_map row_idx_map;
+row_idx_map.reserve(nnr * 7);
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 
 Review comment:
   Agree with @cjolivier01 that O(1) access time doesn't mean instant access. 
There's always some constant factor like cache misses. However, "possibly 
millions of iterations" is too exaggerated - as we know the number of elements 
ahead of time and reserved the number of buckets accordingly, it won't take 
that many steps.
   
   @zheng-da using an array means you have to set the initial value of the 
array. We observed that such array is every expensive to maintain in when array 
size is a few million in _backward_dot. Tree based approach is quite similar to 
the original implementation. 
   
   We definitely need more benchmark data 


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
szha commented on a change in pull request #9995: [WIP] CI docker revamp; Add 
Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173367898
 
 

 ##
 File path: ci/docker/Dockerfile.build.centos7_cpu
 ##
 @@ -0,0 +1,17 @@
+FROM centos:7
 
 Review comment:
   Add similar comment as other docker files?
   ```
   # -*- mode: dockerfile -*-
   # dockerfile to build libmxnet.so for centos7
   ```


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
szha commented on a change in pull request #9995: [WIP] CI docker revamp; Add 
Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173367713
 
 

 ##
 File path: ci/build.py
 ##
 @@ -0,0 +1,182 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+# 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.
+
+"""Multi arch dockerized build tool.
+
+"""
+
+__author__ = 'Marco de Abreu, Kellen Sunderland, Anton Chernov, Pedro Larroy'
+__version__ = '0.1'
+
+import os
+import sys
+import subprocess
+import logging
+import argparse
+from subprocess import check_call, call
+import glob
+import re
+from typing import *
+from itertools import chain
+from copy import deepcopy
+
+
+def get_platforms(path: Optional[str]="docker"):
+"""Get a list of architectures given our dockerfiles"""
+dockerfiles = glob.glob(os.path.join(path, "Dockerfile.build.*"))
+dockerfiles = list(filter(lambda x: x[-1] != '~', dockerfiles))
+files = list(map(lambda x: re.sub(r"Dockerfile.build.(.*)", r"\1", x), 
dockerfiles))
+files.sort()
+platforms = list(map(lambda x: os.path.split(x)[1], files))
+return platforms
+
+
+def get_docker_tag(platform: str) -> None:
+return "mxnet/build.{0}".format(platform)
+
+
+def get_dockerfile(platform: str, path="docker"):
+return os.path.join(path, "Dockerfile.build.{0}".format(platform))
+
+def get_docker_binary(use_nvidia_docker: bool):
+if use_nvidia_docker:
+return "nvidia-docker"
+else:
+return "docker"
+
+def build_docker(platform: str, docker_binary: str) -> None:
+"""Build a container for the given platform"""
+tag = get_docker_tag(platform)
+logging.info("Building container tagged '%s' with %s", tag, docker_binary)
+cmd = [docker_binary, "build",
+"-f", get_dockerfile(platform),
+"--build-arg", "USER_ID={}".format(os.getuid()),
+"-t", tag,
+"docker"]
+logging.info("Running command: '%s'", ' '.join(cmd))
+check_call(cmd)
+
+def get_mxnet_root() -> str:
+curpath = os.path.abspath(os.path.dirname(__file__))
+def is_mxnet_root(path: str) -> bool:
+return os.path.exists(os.path.join(path, ".mxnet_root"))
+while not is_mxnet_root(curpath):
+parent = os.path.abspath(os.path.join(curpath, os.pardir))
+if parent == curpath:
+raise RuntimeError("Got to the root and couldn't find a parent 
folder with .mxnet_root")
+curpath = parent
+return curpath
+
+
+def container_run(platform: str, docker_binary: str, command: List[str]) -> 
None:
+tag = get_docker_tag(platform)
+mx_root = get_mxnet_root()
+#local_build_folder = '{}/build_{}'.format(mx_root, platform)
+local_build_folder = '{}/build'.format(mx_root)
+# We need to create it first, otherwise it will be created by the docker 
daemon with root only permissions
+os.makedirs(local_build_folder, exist_ok=True)
+logging.info("Running %s in container %s", command, tag)
+runlist = [docker_binary, 'run', '--rm',
+#'-v', "{}:/work/mxnet:ro".format(mx_root), # mount mxnet root
+'-v', "{}:/work/mxnet".format(mx_root), # mount mxnet root
+'-v', "{}:/work/build".format(local_build_folder), # mount mxnet/build 
for storing build artifacts
+#'-w', '/work/build',
 
 Review comment:
   Clean up commented code.


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370285916
 
 
   @pengzhao-intel @xinyu-intel 
   Thank you! I will have a try.
   The performance table
   
   name|time (ms)
   --|--
   BBoxTransformInv|268
   IoUTransformInv|Not used
   FilterBox|22
   CopyScore|18
   ReverseArgsort(unstable sort)|7303
   ReorderProposals|338
   nms(calculate area)|286
   nms(calcuate nms)|7547
   allocate memory for workspace|1
   copy anchor to workspace_proposal|0
   enumrate all shifted anchors|9
   copy workspace_proposals_base to workspace_proposals|162
   assign foreground scores for each anchor|45
   prepare output|3
   Total|16002
   
   Using stable sort to sort anchors (ReverseArgsort) will increase about 3000 
ms.
   
   Update: 2018-03-09 (626296b)
   
   name|time (ms)
   --|--
   BBoxTransformInv|523
   FilterBox|35
   CopyScore|49
   ReverseArgsort(unstable sort)|1036
   ReorderProposals|17
   nms|2573
   allocate memory for workspace|4
   GenerateAnchors|0
   copy anchor and score to workspace_proposal|361
   enumerate all shifted anchors|101
   prepare output|0
   Total|4699
   


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370285916
 
 
   @pengzhao-intel @xinyu-intel 
   Thank you! I will have a try.
   The performance table
   
   name|time (ms)
   --|--
   BBoxTransformInv|268
   IoUTransformInv|Not used
   FilterBox|22
   CopyScore|18
   ReverseArgsort(unstable sort)|7303
   ReorderProposals|338
   nms(calculate area)|286
   nms(calcuate nms)|7547
   allocate memory for workspace|1
   copy anchor to workspace_proposal|0
   enumrate all shifted anchors|9
   copy workspace_proposals_base to workspace_proposals|162
   assign foreground scores for each anchor|45
   prepare output|3
   Total|16002
   
   Using stable sort to sort anchors (ReverseArgsort) will increase about 3000 
ms.
   
   Update: 2018-03-09 (626296b)
   
   name|time (ms)
   --|--
   BBoxTransformInv|523
   FilterBox|35
   CopyScore|49
   ReverseArgsort(unstable sort)|1036
   ReorderProposals|17
   nms|2573
   allocate memory for workspace|4
   GenerateAnchors|0
   copy anchor and score to workspace_proposal|361
   enumerate all shifted anchors|101
   prepare output|0
   


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] asitstands opened a new pull request #10048: Random shuffle implementation

2018-03-08 Thread GitBox
asitstands opened a new pull request #10048: Random shuffle implementation
URL: https://github.com/apache/incubator-mxnet/pull/10048
 
 
   ## Description ##
   
   This operator randomly shuffles an NDArray along the first axis. The order 
of the elements in each subarray does not change. For exmaple, if an NDArray 
`x` is shuffled, the order of the subarrays `x[i]` randomly changes but the 
order of the elements in each `x[i]` does not change. This PR is a revise of 
#9991.
   
   ### Implementation
   
   1. In cpu, the shuffling of an 1D array is delegated to 
`__gnu_parallel::random_shuffle`, which utilizes openmp, for clang on linux and 
gcc on any OS and delegated to `std::shuffle` for other platforms. For an 
multidimensional array, the usual Fisher-Yates shuffling is implemented.
   2. In gpu, it shuffles the array of indices representing the subarrays and 
then rearrange the elements of the data array according to the shuffled index 
array. To shuffle the index array, a random key is generated for each index and 
then the indices are sorted by the keys. The sorting is delegated to mshadow's 
`SortByKey` which again delegates the call to thrust's `sort_by_key`.
   
   ### Note
   
   This operator is modeled on `numpy.random.shuffle`.
   
   ## 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)
   - [ ] 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
   


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370133350
 
 
   @pengzhao-intel Here is the testing code.
   https://gist.github.com/wkcn/4a09c142bc9886b45b5a23461bbe4733
   
   I found that I made a mistake that I didn't use `nd.waitall()` to test the 
performance.
   If not using `nd.waitall()`, the calculation will not execute because of 
lazy-evaluation.
   
   performance|CPU(no omp)|CPU(omp)|GPU
   -|---|---|-
   Time(s)|33.899|12.432|4.435
   
   However, when I set the environment variables `MXNET_OMP_MAX_THREADS` or 
`OMP_NUM_THREADS`, it may bring bad performance.
   
   Update: 2018-03-09 (626296b)
   
   performance|CPU(no omp)|CPU(omp)|GPU
   -|---|---|-
   Time(s)|33.899|5.049|4.435
   


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370133350
 
 
   @pengzhao-intel Here is the testing code.
   https://gist.github.com/wkcn/4a09c142bc9886b45b5a23461bbe4733
   
   I found that I made a mistake that I didn't use `nd.waitall()` to test the 
performance.
   If not using `nd.waitall()`, the calculation will not execute because of 
lazy-evaluation.
   
   performance|CPU(no omp)|CPU(omp)|GPU
   -|---|---|-
   Time(s)|33.899|12.432|4.435
   
   However, when I set the environment variables `MXNET_OMP_MAX_THREADS` or 
`OMP_NUM_THREADS`, it may bring bad performance.
   
   Update: 2018-03-09 (626296b)
   performance|CPU(no omp)|CPU(omp)|GPU
   -|---|---|-
   Time(s)|33.899|5.049|4.435
   


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] zihaolucky commented on issue #9195: [WIP]NCE loss gluon

2018-03-08 Thread GitBox
zihaolucky commented on issue #9195: [WIP]NCE loss gluon
URL: https://github.com/apache/incubator-mxnet/pull/9195#issuecomment-371705097
 
 
   Close this PR and create another one.


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] zihaolucky closed pull request #9195: [WIP]NCE loss gluon

2018-03-08 Thread GitBox
zihaolucky closed pull request #9195: [WIP]NCE loss gluon
URL: https://github.com/apache/incubator-mxnet/pull/9195
 
 
   

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/example/gluon/sampler/alias_method.py 
b/example/gluon/sampler/alias_method.py
new file mode 100644
index 000..0e5ebe5923c
--- /dev/null
+++ b/example/gluon/sampler/alias_method.py
@@ -0,0 +1,154 @@
+# 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: skip-file
+import mxnet.ndarray as nd
+import numpy as np
+from mxnet.test_utils import verify_generator
+
+
+class AliasMethodSampler(object):
+""" The Alias Method: Efficient Sampling with Many Discrete Outcomes.
+Can be use in NCELoss.
+
+Parameters
+--
+K : int
+Number of events.
+probs : array
+Probability of each events, corresponds to K.
+
+References
+---
+
https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-method-efficient-sampling-with-many-discrete-outcomes/
+"""
+
+def __init__(self, F, K, probs):
+if K != len(probs):
+raise ValueError("K should be equal to len(probs). K:%d, 
len(probs):%d" % (K, len(probs)))
+self.K = K
+self.prob = F.zeros(K)
+self.alias = F.zeros(K).astype('int32')
+
+# Sort the data into the outcomes with probabilities
+# that are larger and smaller than 1/K.
+smaller = []
+larger = []
+for kk, prob in enumerate(probs):
+self.prob[kk] = K * prob
+if self.prob[kk] < 1.0:
+smaller.append(kk)
+else:
+larger.append(kk)
+
+# Loop though and create little binary mixtures that
+# appropriately allocate the larger outcomes over the
+# overall uniform mixture.
+while len(smaller) > 0 and len(larger) > 0:
+small = smaller.pop()
+large = larger.pop()
+
+self.alias[small] = large
+self.prob[large] = (self.prob[large] - 1.0) + self.prob[small]
+
+if self.prob[large] < 1.0:
+smaller.append(large)
+else:
+larger.append(large)
+
+for last_one in smaller + larger:
+self.prob[last_one] = 1
+
+def draw(self, F, n):
+"""Draw N samples from multinomial
+"""
+samples = F.zeros(n, dtype='int32')
+
+kk = F.floor(F.random.uniform(0, self.K, n)).astype('int32')
+rand = F.random.uniform(0, 1, n)
+
+prob = self.prob[kk]
+alias = self.alias[kk]
+
+for i in xrange(n):
+if rand[i] < prob[i]:
+samples[i] = kk[i]
+else:
+samples[i] = alias[i]
+return samples
+
+
+def speed():
+# use numpy
+import time
+import numpy.random as npr
+
+K = 500
+N = 1
+
+# Get a random probability vector.
+probs = npr.dirichlet(np.ones(K), 1).ravel()
+
+# Construct the table.
+elaps = []
+F = nd
+alias_method_sampler = AliasMethodSampler(F, K, probs)
+for i in range(100):
+start = time.time()
+X = alias_method_sampler.draw(F, N)
+time_elaps = time.time() - start
+elaps.append(time_elaps)
+print(
+'Use NDArray. Avg:%.2f ms, Min:%.2f ms, Max:%.2f ms, Std:%.2f ms'
+% (np.average(elaps), np.min(elaps), np.max(elaps), np.std(elaps)))
+
+# Construct the table.
+elaps = []
+F = nd
+alias_method_sampler = AliasMethodSampler(F, K, probs)
+for i in range(100):
+start = time.time()
+X = alias_method_sampler.draw(F, N)
+time_elaps = time.time() - start
+elaps.append(time_elaps)
+print(
+'Use Numpy. Avg:%.2f ms, Min:%.2f ms, Max:%.2f ms, Std:%.2f ms'
+% (np.average(elaps), np.min(elaps), np.max(elaps), np.std(elaps)))
+
+
+def chi_square_test():
+probs = [0.1, 0.2, 0.3, 0.05, 0.15, 0.2]
+buckets = list(range(6))
+
+F = np
+   

[GitHub] chinakook opened a new issue #10047: Can "NHWC" layout support come back?

2018-03-08 Thread GitBox
chinakook opened a new issue #10047: Can "NHWC" layout support come back?
URL: https://github.com/apache/incubator-mxnet/issues/10047
 
 
   MXNetError: [11:16:26] src/operator/nn/./convolution-inl.h:163: Check 
failed: param_.layout.value() == mshadow::kNCW || param_.layout.value() == 
mshadow::kNCHW || param_.layout.value() == mshadow::kNCDHW Only support NCW, 
NCHW and NCDHW layout


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 #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9958: Parallelization for 
ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958#discussion_r173356859
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -74,7 +79,13 @@ inline void ROIPoolForward(const Tensor ,
 
 const Dtype* batch_data = bottom_data + data_size * roi_batch_ind;
 
+#pragma omp parallel for firstprivate(batch_data, top_data, argmax_data)
 for (int c = 0; c < channels_; ++c) {
+  // Increment all data pointers
+  const Dtype* batch_data_c = batch_data + c * data_size_c;
+  Dtype* top_data_c = top_data + c * out_size_c;
+  Dtype* argmax_data_c = argmax_data + c * max_idx_size_c;
+
 
 Review comment:
   try to keep in mind in the future that we support less-awesome CPUs than 
Intel Skylake :)


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 commented on a change in pull request #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

2018-03-08 Thread GitBox
reminisce commented on a change in pull request #9947: [WIP] Performance 
optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r173354681
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
 mxnet_op::Kernel::Launch(s, num_threads,
   
ret->dptr());
   }
-  num_threads = mxnet_op::get_num_threads(ret->shape_[0]);
-  dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+  num_threads = ret->shape_[0];
   if (trans_lhs) {
 LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, 
rsp) = dns yet";
   } else {
+const RType* row_idx_ptr = row_idx_r.dptr();
+std::unordered_map row_idx_map;
+row_idx_map.reserve(nnr * 7);
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 
 Review comment:
   The real number of rows is from 1 million to 8 million in the customer case. 
Using an array would waste a lot of memory if `nnr` is far less than the real 
number of rows. Using a tree based data structure is in nature similar to the 
binary search approach that was originally implemented. I think we should 
consider using different approaches for different dimension configurations 
after thorough benchmarks.


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] zhaodongsun opened a new issue #10046: mx.nd.UpSampling issue

2018-03-08 Thread GitBox
zhaodongsun opened a new issue #10046: mx.nd.UpSampling issue
URL: https://github.com/apache/incubator-mxnet/issues/10046
 
 
An error occurs when I run this code.
   
   `a=mx.nd.random.uniform(shape=(4,3,2,2)) `
   `b=mx.nd.UpSampling(a,scale=2,sample_type='bilinear')`
   
   MXNetError: [02:46:29] src/c_api/../imperative/imperative_utils.h:313: Check 
failed: num_inputs == infered_num_inputs (1 vs. 2) Operator UpSampling expects 
2 inputs, but got 1 instead.
   
   It seems to have another argument, maybe weight? I don't know the meaning of 
the argument.
   
   If I modify `sample_type` with `nearest`, the code can run normally.
   


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 nlp_toolkit updated (329acde -> a61fd99)

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

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


 discard 329acde  gluon language modeling dataset and text token reader (#9986)
 new a61fd99  gluon language modeling dataset and text token reader (#9986)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (329acde)
\
 N -- N -- N   refs/heads/nlp_toolkit (a61fd99)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 python/mxnet/gluon/data/text/lm.py | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
zhash...@apache.org.


[incubator-mxnet] 01/01: gluon language modeling dataset and text token reader (#9986)

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

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

commit a61fd99b44318aa1ed5a43ca91d666e4c0134d15
Author: Sheng Zha 
AuthorDate: Thu Mar 8 16:49:51 2018 -0500

gluon language modeling dataset and text token reader (#9986)

* language modeling dataset and text token reader.

* update

* add padding

* update bos insert

* update doc
---
 example/gluon/word_language_model/train.py |  44 ---
 python/mxnet/gluon/data/__init__.py|   2 +
 .../gluon/data/{__init__.py => datareader.py}  |  18 ++-
 python/mxnet/gluon/data/{ => text}/__init__.py |  10 +-
 .../gluon/data/{__init__.py => text/_constants.py} |  12 +-
 python/mxnet/gluon/data/text/base.py   | 103 +++
 python/mxnet/gluon/data/text/lm.py | 145 +
 python/mxnet/gluon/data/text/utils.py  |  73 +++
 tests/python/unittest/test_gluon_data_text.py  |  50 +++
 9 files changed, 420 insertions(+), 37 deletions(-)

diff --git a/example/gluon/word_language_model/train.py 
b/example/gluon/word_language_model/train.py
index b69fd17..c732393 100644
--- a/example/gluon/word_language_model/train.py
+++ b/example/gluon/word_language_model/train.py
@@ -16,13 +16,13 @@
 # under the License.
 
 import argparse
+import collections
 import time
 import math
 import mxnet as mx
-from mxnet import gluon, autograd
-from mxnet.gluon import contrib
+from mxnet import gluon, autograd, contrib
+from mxnet.gluon import data
 import model
-import data
 
 parser = argparse.ArgumentParser(description='MXNet Autograd RNN/LSTM Language 
Model on Wikitext-2.')
 parser.add_argument('--model', type=str, default='lstm',
@@ -71,32 +71,40 @@ if args.cuda:
 else:
 context = mx.cpu(0)
 
-train_dataset = contrib.data.text.WikiText2('./data', 'train', 
seq_len=args.bptt)
-vocab = train_dataset.vocabulary
-val_dataset, test_dataset = [contrib.data.text.WikiText2('./data', segment,
- vocab=vocab,
- seq_len=args.bptt)
- for segment in ['validation', 'test']]
+train_dataset = data.text.lm.WikiText2('./data', 'train', seq_len=args.bptt,
+   eos='')
+
+def get_frequencies(dataset):
+return collections.Counter(x for tup in dataset for x in tup[0] if x)
+
+vocab = contrib.text.vocab.Vocabulary(get_frequencies(train_dataset))
+def index_tokens(data, label):
+return vocab.to_indices(data), vocab.to_indices(label)
+
+val_dataset, test_dataset = [data.text.lm.WikiText2('./data', segment,
+seq_len=args.bptt,
+eos='')
+ for segment in ['val', 'test']]
 
 nbatch_train = len(train_dataset) // args.batch_size
-train_data = gluon.data.DataLoader(train_dataset,
+train_data = gluon.data.DataLoader(train_dataset.transform(index_tokens),
batch_size=args.batch_size,
-   
sampler=contrib.data.IntervalSampler(len(train_dataset),
-
nbatch_train),
+   
sampler=gluon.contrib.data.IntervalSampler(len(train_dataset),
+  
nbatch_train),
last_batch='discard')
 
 nbatch_val = len(val_dataset) // args.batch_size
-val_data = gluon.data.DataLoader(val_dataset,
+val_data = gluon.data.DataLoader(val_dataset.transform(index_tokens),
  batch_size=args.batch_size,
- 
sampler=contrib.data.IntervalSampler(len(val_dataset),
-  
nbatch_val),
+ 
sampler=gluon.contrib.data.IntervalSampler(len(val_dataset),
+
nbatch_val),
  last_batch='discard')
 
 nbatch_test = len(test_dataset) // args.batch_size
-test_data = gluon.data.DataLoader(test_dataset,
+test_data = gluon.data.DataLoader(test_dataset.transform(index_tokens),
   batch_size=args.batch_size,
-  
sampler=contrib.data.IntervalSampler(len(test_dataset),
-   
nbatch_test),
+  
sampler=gluon.contrib.data.IntervalSampler(len(test_dataset),
+ 
nbatch_test),

[GitHub] wangx404 commented on issue #10019: ModuleNotFoundError

2018-03-08 Thread GitBox
wangx404 commented on issue #10019: ModuleNotFoundError
URL: 
https://github.com/apache/incubator-mxnet/issues/10019#issuecomment-371692811
 
 
   3Q. I think this may be the reason. I have forgotten mxnet using C code to 
spped up.


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] yuewu001 commented on issue #9557: update_on_kvstore error setting with multiple machines

2018-03-08 Thread GitBox
yuewu001 commented on issue #9557: update_on_kvstore error setting with 
multiple machines
URL: 
https://github.com/apache/incubator-mxnet/issues/9557#issuecomment-371690862
 
 
   Thank you for your reply. Do you have any ideas on how to 
save_optimizer_states property in distributed training, especially when 
update_on_kvstore is True?


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 #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
pengzhao-intel commented on issue #9958: Parallelization for ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958#issuecomment-371685877
 
 
   @cjolivier01 Could you help review again? 
   Our customer requested this features and want to get the usable code from 
official repo ASAP.
   Thanks in advance.


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: Parallelization for ROIpooling OP (#9958)

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

cjolivier01 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 884408a  Parallelization for ROIpooling OP (#9958)
884408a is described below

commit 884408a065a7872fda3b22418a8ba35f89ff58e8
Author: XinyuChen 
AuthorDate: Fri Mar 9 09:56:39 2018 +0800

Parallelization for ROIpooling OP (#9958)

* parallelization for roipooling

* remove some useless computation

* remove useless muls

* add author and retriggering

* retrigger again
---
 src/operator/roi_pooling.cc | 48 ++---
 1 file changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/operator/roi_pooling.cc b/src/operator/roi_pooling.cc
index 10d1420..acff1f9 100644
--- a/src/operator/roi_pooling.cc
+++ b/src/operator/roi_pooling.cc
@@ -21,7 +21,7 @@
  * Copyright (c) 2015 by Contributors
  * \file roi_pooling.cc
  * \brief roi pooling operator
- * \author Ross Girshick, Kye-Hyeon Kim, Jian Guo
+ * \author Ross Girshick, Kye-Hyeon Kim, Jian Guo, Xinyu Chen
 */
 #include "./roi_pooling-inl.h"
 #include 
@@ -54,13 +54,22 @@ inline void ROIPoolForward(const Tensor ,
 
   const int num_rois = bbox.size(0);
   const int data_size = data.size(1) * data.size(2) * data.size(3);
+  const int data_size_c = data.size(2) * data.size(3);
+  const int out_size_c = out.size(2) * out.size(3);
+  const int out_size = channels_ * out_size_c;
+  const int max_idx_size_c = max_idx.size(2) * max_idx.size(3);
+  const int max_idx_size = channels_ * max_idx_size_c;
   // For each ROI R = [batch_index x1 y1 x2 y2]: max pool over R
   for (int n = 0; n < num_rois; ++n) {
-int roi_batch_ind = bottom_rois[0];
-int roi_start_w = round(bottom_rois[1] * spatial_scale_);
-int roi_start_h = round(bottom_rois[2] * spatial_scale_);
-int roi_end_w = round(bottom_rois[3] * spatial_scale_);
-int roi_end_h = round(bottom_rois[4] * spatial_scale_);
+// Increment ROI data pointer
+const Dtype *bottom_rois_n = bottom_rois + n * bbox.size(1);
+Dtype *top_data_n = top_data + n * out_size;
+Dtype *argmax_data_n = argmax_data + n * max_idx_size;
+int roi_batch_ind = bottom_rois_n[0];
+int roi_start_w = round(bottom_rois_n[1] * spatial_scale_);
+int roi_start_h = round(bottom_rois_n[2] * spatial_scale_);
+int roi_end_w = round(bottom_rois_n[3] * spatial_scale_);
+int roi_end_h = round(bottom_rois_n[4] * spatial_scale_);
 assert(roi_batch_ind >= 0);
 assert(static_cast(roi_batch_ind) < data.size(0) /* batch size 
*/);
 
@@ -74,12 +83,18 @@ inline void ROIPoolForward(const Tensor ,
 
 const Dtype* batch_data = bottom_data + data_size * roi_batch_ind;
 
+#pragma omp parallel for
 for (int c = 0; c < channels_; ++c) {
+  // Increment all data pointers
+  const Dtype* batch_data_c = batch_data + c * data_size_c;
+  Dtype* top_data_c = top_data_n + c * out_size_c;
+  Dtype* argmax_data_c = argmax_data_n + c * max_idx_size_c;
+
   for (int ph = 0; ph < pooled_height_; ++ph) {
 for (int pw = 0; pw < pooled_width_; ++pw) {
   // Compute pooling region for this output unit:
-  //  start (included) = floor(ph * roi_height / pooled_height_)
-  //  end (excluded) = ceil((ph + 1) * roi_height / pooled_height_)
+  // start (included) = floor(ph * roi_height / pooled_height_)
+  // end (excluded) = ceil((ph + 1) * roi_height / pooled_height_)
   int hstart = static_cast(floor(static_cast(ph)
   * bin_size_h));
   int wstart = static_cast(floor(static_cast(pw)
@@ -98,30 +113,23 @@ inline void ROIPoolForward(const Tensor 
,
 
   const int pool_index = ph * pooled_width_ + pw;
   if (is_empty) {
-top_data[pool_index] = 0;
-argmax_data[pool_index] = -1;
+top_data_c[pool_index] = 0;
+argmax_data_c[pool_index] = -1;
   }
 
   for (int h = hstart; h < hend; ++h) {
 for (int w = wstart; w < wend; ++w) {
   const int index = h * width_ + w;
-  if (batch_data[index] > top_data[pool_index]) {
-top_data[pool_index] = batch_data[index];
-argmax_data[pool_index] = index;
+  if (batch_data_c[index] > top_data_c[pool_index]) {
+top_data_c[pool_index] = batch_data_c[index];
+argmax_data_c[pool_index] = index;
   }
 }
   }
 }
   }
-  // Increment all data pointers by one channel
-  batch_data += data.size(2) * data.size(3);
-  top_data += out.size(2) * out.size(3);
-  argmax_data += max_idx.size(2) * max_idx.size(3);
 }
-

[GitHub] cjolivier01 closed pull request #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
cjolivier01 closed pull request #9958: Parallelization for ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958
 
 
   

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/operator/roi_pooling.cc b/src/operator/roi_pooling.cc
index 10d1420950c..acff1f97dcc 100644
--- a/src/operator/roi_pooling.cc
+++ b/src/operator/roi_pooling.cc
@@ -21,7 +21,7 @@
  * Copyright (c) 2015 by Contributors
  * \file roi_pooling.cc
  * \brief roi pooling operator
- * \author Ross Girshick, Kye-Hyeon Kim, Jian Guo
+ * \author Ross Girshick, Kye-Hyeon Kim, Jian Guo, Xinyu Chen
 */
 #include "./roi_pooling-inl.h"
 #include 
@@ -54,13 +54,22 @@ inline void ROIPoolForward(const Tensor ,
 
   const int num_rois = bbox.size(0);
   const int data_size = data.size(1) * data.size(2) * data.size(3);
+  const int data_size_c = data.size(2) * data.size(3);
+  const int out_size_c = out.size(2) * out.size(3);
+  const int out_size = channels_ * out_size_c;
+  const int max_idx_size_c = max_idx.size(2) * max_idx.size(3);
+  const int max_idx_size = channels_ * max_idx_size_c;
   // For each ROI R = [batch_index x1 y1 x2 y2]: max pool over R
   for (int n = 0; n < num_rois; ++n) {
-int roi_batch_ind = bottom_rois[0];
-int roi_start_w = round(bottom_rois[1] * spatial_scale_);
-int roi_start_h = round(bottom_rois[2] * spatial_scale_);
-int roi_end_w = round(bottom_rois[3] * spatial_scale_);
-int roi_end_h = round(bottom_rois[4] * spatial_scale_);
+// Increment ROI data pointer
+const Dtype *bottom_rois_n = bottom_rois + n * bbox.size(1);
+Dtype *top_data_n = top_data + n * out_size;
+Dtype *argmax_data_n = argmax_data + n * max_idx_size;
+int roi_batch_ind = bottom_rois_n[0];
+int roi_start_w = round(bottom_rois_n[1] * spatial_scale_);
+int roi_start_h = round(bottom_rois_n[2] * spatial_scale_);
+int roi_end_w = round(bottom_rois_n[3] * spatial_scale_);
+int roi_end_h = round(bottom_rois_n[4] * spatial_scale_);
 assert(roi_batch_ind >= 0);
 assert(static_cast(roi_batch_ind) < data.size(0) /* batch size 
*/);
 
@@ -74,12 +83,18 @@ inline void ROIPoolForward(const Tensor ,
 
 const Dtype* batch_data = bottom_data + data_size * roi_batch_ind;
 
+#pragma omp parallel for
 for (int c = 0; c < channels_; ++c) {
+  // Increment all data pointers
+  const Dtype* batch_data_c = batch_data + c * data_size_c;
+  Dtype* top_data_c = top_data_n + c * out_size_c;
+  Dtype* argmax_data_c = argmax_data_n + c * max_idx_size_c;
+
   for (int ph = 0; ph < pooled_height_; ++ph) {
 for (int pw = 0; pw < pooled_width_; ++pw) {
   // Compute pooling region for this output unit:
-  //  start (included) = floor(ph * roi_height / pooled_height_)
-  //  end (excluded) = ceil((ph + 1) * roi_height / pooled_height_)
+  // start (included) = floor(ph * roi_height / pooled_height_)
+  // end (excluded) = ceil((ph + 1) * roi_height / pooled_height_)
   int hstart = static_cast(floor(static_cast(ph)
   * bin_size_h));
   int wstart = static_cast(floor(static_cast(pw)
@@ -98,30 +113,23 @@ inline void ROIPoolForward(const Tensor 
,
 
   const int pool_index = ph * pooled_width_ + pw;
   if (is_empty) {
-top_data[pool_index] = 0;
-argmax_data[pool_index] = -1;
+top_data_c[pool_index] = 0;
+argmax_data_c[pool_index] = -1;
   }
 
   for (int h = hstart; h < hend; ++h) {
 for (int w = wstart; w < wend; ++w) {
   const int index = h * width_ + w;
-  if (batch_data[index] > top_data[pool_index]) {
-top_data[pool_index] = batch_data[index];
-argmax_data[pool_index] = index;
+  if (batch_data_c[index] > top_data_c[pool_index]) {
+top_data_c[pool_index] = batch_data_c[index];
+argmax_data_c[pool_index] = index;
   }
 }
   }
 }
   }
-  // Increment all data pointers by one channel
-  batch_data += data.size(2) * data.size(3);
-  top_data += out.size(2) * out.size(3);
-  argmax_data += max_idx.size(2) * max_idx.size(3);
 }
-// Increment ROI data pointer
-bottom_rois += bbox.size(1);
   }
-
   return;
 }
 


 


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,

[GitHub] cjolivier01 commented on issue #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
cjolivier01 commented on issue #9958: Parallelization for ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958#issuecomment-371687737
 
 
   LGTM


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 #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9958: Parallelization for 
ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958#discussion_r173347236
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -74,7 +79,13 @@ inline void ROIPoolForward(const Tensor ,
 
 const Dtype* batch_data = bottom_data + data_size * roi_batch_ind;
 
+#pragma omp parallel for firstprivate(batch_data, top_data, argmax_data)
 for (int c = 0; c < channels_; ++c) {
+  // Increment all data pointers
+  const Dtype* batch_data_c = batch_data + c * data_size_c;
+  Dtype* top_data_c = top_data + c * out_size_c;
+  Dtype* argmax_data_c = argmax_data + c * max_idx_size_c;
+
 
 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] pengzhao-intel commented on issue #9958: Parallelization for ROIpooling OP

2018-03-08 Thread GitBox
pengzhao-intel commented on issue #9958: Parallelization for ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958#issuecomment-371685877
 
 
   @cjolivier01 Could you help review again? 
   Our customer requested this features and want to get the usable code from 
official repo ASAP.
   Thanks in advance.


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370285916
 
 
   @pengzhao-intel @xinyu-intel 
   Thank you! I will have a try.
   The performance table
   
   name|time (ms)
   --|--
   BBoxTransformInv|268
   IoUTransformInv|Not used
   FilterBox|22
   CopyScore|18
   ReverseArgsort(unstable sort)|7303
   ReorderProposals|338
   nms(calculate area)|286
   nms(calcuate nms)|7547
   allocate memory for workspace|1
   copy anchor to workspace_proposal|0
   enumrate all shifted anchors|9
   copy workspace_proposals_base to workspace_proposals|162
   assign foreground scores for each anchor|45
   prepare output|3
   Total|16002
   
   Using stable sort to sort anchors (ReverseArgsort) will increase about 3000 
ms.


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 a change in pull request #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

2018-03-08 Thread GitBox
zheng-da commented on a change in pull request #9947: [WIP] Performance 
optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r173340887
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
 mxnet_op::Kernel::Launch(s, num_threads,
   
ret->dptr());
   }
-  num_threads = mxnet_op::get_num_threads(ret->shape_[0]);
-  dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+  num_threads = ret->shape_[0];
   if (trans_lhs) {
 LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, 
rsp) = dns yet";
   } else {
+const RType* row_idx_ptr = row_idx_r.dptr();
+std::unordered_map row_idx_map;
+row_idx_map.reserve(nnr * 7);
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 
 Review comment:
   we can use an array to map row id to the physical location. It will take 
O(N) memory. we can potentially use a tree (e.g., B+tree) to map row ids. In 
this case, we can trade off the number of memory accesses with memory size.


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370285916
 
 
   @pengzhao-intel @xinyu-intel 
   Thank you! I will have a try.
   The performance table
   
   name|time (ms)
   --|--
   BBoxTransformInv|268
   IoUTransformInv|Not used
   FilterBox|22
   CopyScore|18
   ReverseArgsort(unstable sort)|7303
   ReorderProposals|338
   nms(calculate area)|286
   nms(calcuate nms)|7547
   allocate memory for workspace|1
   copy anchor to workspace_proposal|0
   enumrate all shifted anchors|9
   copy workspace_proposals_base to workspace_proposals|162
   assign foreground scores for each anchor|45
   prepare output|3
   Total|16002
   
   Using stable sort to sort anchors (ReverseArgsort) will increase about 3000 
ms.
   **Sorry, it seems that I counted the time of all threads. I will update the 
performance table.**
   
   


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] wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-08 Thread GitBox
wkcn commented on issue #9939: [MXNET-40]add multi proposal operator (cpu 
version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#issuecomment-370285916
 
 
   @pengzhao-intel @xinyu-intel 
   Thank you! I will have a try.
   The performance table
   
   name|time (ms)
   --|--
   BBoxTransformInv|268
   IoUTransformInv|Not used
   FilterBox|22
   CopyScore|18
   ReverseArgsort(unstable sort)|7303
   ReorderProposals|338
   nms(calculate area)|286
   nms(calcuate nms)|7547
   allocate memory for workspace|1
   copy anchor to workspace_proposal|0
   enumrate all shifted anchors|9
   copy workspace_proposals_base to workspace_proposals|162
   assign foreground scores for each anchor|45
   prepare output|3
   Total|16002
   
   Using stable sort to sort anchors (ReverseArgsort) will increase about 3000 
ms.
   Sorry, it seems that I counted the time of all threads. I will update the 
performance table.
   
   


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 a change in pull request #10025: Language model with Google's billion words dataset

2018-03-08 Thread GitBox
pengzhao-intel commented on a change in pull request #10025: Language model 
with Google's billion words dataset
URL: https://github.com/apache/incubator-mxnet/pull/10025#discussion_r173338682
 
 

 ##
 File path: src/operator/nn/fully_connected.cc
 ##
 @@ -73,22 +76,47 @@ static bool FullyConnectedShape(const nnvm::NodeAttrs& 
attrs,
   return true;
 }
 
-#if MXNET_USE_MKLDNN == 1
 void FullyConnectedComputeExCPU(const nnvm::NodeAttrs& attrs,
 const OpContext ,
 const std::vector ,
 const std::vector ,
 const std::vector ) {
-  if (SupportMKLDNN(inputs[0])) {
-MKLDNN_OPCHECK_INIT(false, outputs.size(), inputs, outputs);
-MKLDNNFCForward(attrs, ctx, inputs, req, outputs);
-MKLDNN_OPCHECK_RUN(FullyConnectedCompute, attrs, ctx, inputs, req,
-   outputs);
+  const FullyConnectedParam& param = 
nnvm::get(attrs.parsed);
+  const bool valid_data = inputs[0].storage_type() == kDefaultStorage;
+  const bool valid_weight = inputs[1].storage_type() == kDefaultStorage ||
+inputs[1].storage_type() == kRowSparseStorage;
+  const bool valid_out = outputs[0].storage_type() == kDefaultStorage;
+  bool valid_bias = true;
+  if (!param.no_bias) {
+valid_bias = inputs[2].storage_type() == kDefaultStorage ||
+ inputs[2].storage_type() == kRowSparseStorage;
+  }
+#if MXNET_USE_MKLDNN == 1
+  if (common::ContainsOnlyStorage(inputs, kDefaultStorage) &&
+  common::ContainsOnlyStorage(outputs, kDefaultStorage)) {
+if (SupportMKLDNN(inputs[0])) {
+  MKLDNN_OPCHECK_INIT(false, outputs.size(), inputs, outputs);
+  MKLDNNFCForward(attrs, ctx, inputs, req, outputs);
+  MKLDNN_OPCHECK_RUN(FullyConnectedCompute, attrs, ctx, inputs, req,
+ outputs);
+} else {
+  FallBackCompute(FullyConnectedCompute, attrs, ctx, inputs, req, 
outputs);
+}
 return;
   }
-  FallBackCompute(FullyConnectedCompute, attrs, ctx, inputs, req, 
outputs);
+#endif
+  if (valid_data && valid_weight && valid_bias && valid_out) {
+std::vector in_blobs(inputs.size());
+for (size_t i = 0; i < in_blobs.size(); i++) in_blobs[i] = 
inputs[i].data();
 
 Review comment:
   So, the `data()` should be improved functionality. The developer doesn't 
know there's a potential issue when working with other formats of 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] sxjscience commented on issue #10025: Language model with Google's billion words dataset

2018-03-08 Thread GitBox
sxjscience commented on issue #10025: Language model with Google's billion 
words dataset
URL: https://github.com/apache/incubator-mxnet/pull/10025#issuecomment-371674634
 
 
   @eric-haibin-lin The RNN.unroll is just updated to support variable length. 
Need to resolve the conflict.


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-08 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_r173336298
 
 

 ##
 File path: python/mxnet/contrib/__init__.py
 ##
 @@ -28,5 +28,5 @@
 from . import tensorboard
 
 from . import text
-
+from . import onnx
 
 Review comment:
   No, there is no namespace clash. The import module in onnx folder is name 
'_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] anirudhacharya commented on a change in pull request #9963: [MXNET-34] Onnx Module to import onnx models into mxnet

2018-03-08 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_r173335708
 
 

 ##
 File path: example/onnx/test_super_resolution.py
 ##
 @@ -0,0 +1,62 @@
+# 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.
+
+"""Testing super_resolution model conversion"""
 
 Review comment:
   it has been added


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] yifeim opened a new issue #10045: Despite so many declarations, Module is still confused by extra names in DataIter

2018-03-08 Thread GitBox
yifeim opened a new issue #10045: Despite so many declarations, Module is still 
confused by extra names in DataIter
URL: https://github.com/apache/incubator-mxnet/issues/10045
 
 
   ## Description
   
   I provide data_names to module declaration, module binding, and DataIter. 
Still, my module will just use whichever data_name that pleases it. Please at 
least drop errors when there are extra names in DataIter.
   
   ## Environment info (Required)
   
   --Python Info--
   Version  : 3.6.4
   Compiler : GCC 7.2.0
   Build: ('default', 'Jan 16 2018 18:10:19')
   Arch : ('64bit', '')
   Pip Info---
   Version  : 9.0.1
   Directory: 
/home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/pip
   --MXNet Info---
   Version  : 1.0.0
   Directory: 
/home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet
   Commit Hash   : 9ef196909ec7bf9cdda66d5b97c92793109798e1
   --System Info--
   Platform : Linux-4.4.0-1052-aws-x86_64-with-debian-stretch-sid
   system   : Linux
   node : ip-172-31-0-77
   release  : 4.4.0-1052-aws
   version  : #61-Ubuntu SMP Mon Feb 12 23:05:58 UTC 2018
   --Hardware Info--
   machine  : x86_64
   processor: x86_64
   --Network Test--
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0024 
sec, LOAD: 0.5823 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.1722 sec, LOAD: 
0.0692 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.1271 sec, LOAD: 
0.2519 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
 DNS: 0.0490 sec, LOAD: 0.7062 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0177 sec, LOAD: 
0.2762 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0095 sec, 
LOAD: 0.0591 sec.
   
   Package used (Python/R/Scala/Julia):
   Python
   
   ## Error Message:
   
   ## Minimum reproducible example
   
   ```
   import mxnet as mx
   train_iter = mx.io.NDArrayIter({
   'i0' : mx.nd.zeros(5,),
   'i1' : mx.nd.ones(5,),
   }, batch_size=5)
   
   net = mx.sym.var('i1')
   mod = mx.module.Module(net, ['i1'], None)
   mod.bind([('i1', (5,))], None)
   mod.init_params()
   mod.predict(train_iter)
   
   ## expected output: [1,1,1,1,1]; actual output [0,0,0,0,0]
   ```


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 #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9947: [WIP] Performance 
optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r17323
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
 mxnet_op::Kernel::Launch(s, num_threads,
   
ret->dptr());
   }
-  num_threads = mxnet_op::get_num_threads(ret->shape_[0]);
-  dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+  num_threads = ret->shape_[0];
   if (trans_lhs) {
 LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, 
rsp) = dns yet";
   } else {
+const RType* row_idx_ptr = row_idx_r.dptr();
+std::unordered_map row_idx_map;
+row_idx_map.reserve(nnr * 7);
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 
 Review comment:
   also, hash tables, while O(1) access time, are pretty expensive for each 
access (creating the hash) for something like this where you may be doing 
possibly millions of iterations each pass.  Is there any way to not use a hash 
table, possibly using more memory?


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173332947
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 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] cjolivier01 commented on a change in pull request #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173332972
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   thanks for checking


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] mongoose54 opened a new issue #10044: How can I use im2rec.py to generate .bin files?

2018-03-08 Thread GitBox
mongoose54 opened a new issue #10044: How can I use im2rec.py to generate .bin 
files?
URL: https://github.com/apache/incubator-mxnet/issues/10044
 
 
   I have modified `im2rec.py` to be more flexible with various image 
manipulations? However I see that `im2rec.py` is not generating .bin files like 
`bin/im2rec` does. So how can I modify `im2rec.py` to generate .bin files of 
images? Or is it just a nice feature to have?


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
marcoabreu commented on a change in pull request #9995: [WIP] CI docker revamp; 
Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173332212
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   No it won't. I just double checked.


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173331575
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   I understand, however I think the following code will take the if branch, 
which it shouldn't:
   ```python
   lib_from_env = ""
   if lib_from_env:
  print(lib_from_env)
   ```


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
marcoabreu commented on a change in pull request #9995: [WIP] CI docker revamp; 
Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173330602
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   Just open the code and look below the introduced if-block :D


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173331575
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   I understand, however I think the following code will take the if branch, 
which it shouldn't:
   ```python
   lib_from_env = "
   if lib_from_env:
  print(lib_from_env)
   ```


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 a change in pull request #9947: [WIP] Performance optimization for dot(csr, rsp) on cpu

2018-03-08 Thread GitBox
zheng-da commented on a change in pull request #9947: [WIP] Performance 
optimization for dot(csr, rsp) on cpu
URL: https://github.com/apache/incubator-mxnet/pull/9947#discussion_r173331483
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -793,16 +764,21 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
 mxnet_op::Kernel::Launch(s, num_threads,
   
ret->dptr());
   }
-  num_threads = mxnet_op::get_num_threads(ret->shape_[0]);
-  dim_t seg_len = (ret->shape_[0] + num_threads - 1) / num_threads;
+  num_threads = ret->shape_[0];
   if (trans_lhs) {
 LOG(FATAL) << "DotCsrRspDnsImpl has not implemented dot(csr.T, 
rsp) = dns yet";
   } else {
+const RType* row_idx_ptr = row_idx_r.dptr();
+std::unordered_map row_idx_map;
+row_idx_map.reserve(nnr * 7);
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 
 Review comment:
   if nnr is large, constructing the hashtable can take a long time.


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
marcoabreu commented on a change in pull request #9995: [WIP] CI docker revamp; 
Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173330808
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   it continue in line 32/44 as before - we just inserted special handling in 
case that variable is set


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-08 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_r173329728
 
 

 ##
 File path: Jenkinsfile
 ##
 @@ -649,7 +649,20 @@ try {
   }
 
   stage('Integration Test') {
-parallel 'Python GPU': {
+   parallel 'Python CPU': {
+  node('mxnetlinux-cpu') {
+ws('workspace/it-python-cpu') {
+  init_git()
+  unpack_lib('cpu')
+  timeout(time: max_time, unit: 'MINUTES') {
+sh "${docker_run} cpu --dockerbinary docker PYTHONPATH=./python/ 
python tests/python/integrationtest/onnx_backend_test.py"
+sh "${docker_run} cpu --dockerbinary docker PYTHONPATH=./python/ 
python tests/python/integrationtest/test_layers.py"
 
 Review comment:
   please create a folder called ``tests/python-pytest/onnx`` instead. Right, 
then you'll have to make the appropriate changes to the dockerfiles


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-08 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_r173329488
 
 

 ##
 File path: python/mxnet/contrib/__init__.py
 ##
 @@ -28,5 +28,5 @@
 from . import tensorboard
 
 from . import text
-
+from . import onnx
 
 Review comment:
   Ah I understand, thanks for elaborating. Could there be a possible namespace 
clash?


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] Mkldnn pooling convention crash

2018-03-08 Thread GitBox
marcoabreu commented on issue #10021: [MXNET-33] Mkldnn pooling convention crash
URL: https://github.com/apache/incubator-mxnet/pull/10021#issuecomment-371665164
 
 
   Feel free to develop and add an appropriate unit test yourself. Please don't 
hesitate to reach out to us in case you need assistance.


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 closed pull request #10031: [MXNET-67] Sync master with v1.1.0 branch

2018-03-08 Thread GitBox
marcoabreu closed pull request #10031: [MXNET-67] Sync master with v1.1.0 branch
URL: https://github.com/apache/incubator-mxnet/pull/10031
 
 
   

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/LICENSE b/LICENSE
index d3b3d6f9dd0..e7d50c37723 100644
--- a/LICENSE
+++ b/LICENSE
@@ -201,43 +201,145 @@
See the License for the specific language governing permissions and
limitations under the License.
 
-===
+
==
 Apache MXNET (incubating) Subcomponents:
 
-The Apache MXNET (incubating) project contains subcomponents with separate
-copyright notices and license terms. Your use of the source code for the 
these
+The Apache MXNET (incubating) project contains subcomponents with separate 
copyright
+notices and license terms. Your use of the source code for the these
 subcomponents is subject to the terms and conditions of the following
-licenses -
-
-
-1. Apache-2.0 license as above, wherever applicable
-
-
-
-2. MIT license wherever applicable
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-3. BSD License wherever applicable
-
+licenses.
+
+
===
+Apache-2.0 licenses
+
===
+
+The following components are provided under an Apache 2.0 license.
+
+1. MXNet Cpp-package - For details, /cpp-package/LICENSE
+2. MXNet rcnn - For details, see, example/rcnn/LICENSE
+3. scala-package - For details, see, scala-package/LICENSE
+4. Warp-CTC - For details, see, src/operator/contrib/ctc_include/LICENSE
+5. dlpack - For details, see, dlpack/LICENSE
+6. dmlc-core - For details, see, dmlc-core/LICENSE
+7. mshadow - For details, see, mshadow/LICENSE
+8. nnvm/dmlc-core - For details, see, nnvm/dmlc-core/LICENSE
+9. nnvm - For details, see, nnvm/LICENSE
+10. nnvm-fusion - For details, see, nnvm/plugin/nnvm-fusion/LICENSE
+11. ps-lite - For details, see, ps-lite/LICENSE
+12. nnvm/tvm - For details, see, nnvm/tvm/LICENSE
+13. googlemock scripts/generator - For details, see, 
3rdparty/googletest/googlemock/scripts/generator/LICENSE
+
+
+
===
+MIT licenses
+
===
+
+1. Fast R-CNN  - For details, see example/rcnn/LICENSE
+2. Faster R-CNN - For details, see example/rcnn/LICENSE
+3. tree_lstm - For details, see example/gluon/tree_lstm/LICENSE
+4. OpenMP - For details, see 3rdparty/openmp/LICENSE.txt
+5. HalideIR - For details, see nnvm/tvm/HalideIR/LICENSE
+
+
+
===
+NVIDIA Licenses
+
===
+
+1. Moderngpu
+For details, see, 
src/operator/contrib/ctc_include/contrib/moderngpu/LICENSE
+
+

[incubator-mxnet] branch master updated: [MXNET-67] Sync master with v1.1.0 branch (#10031)

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

marcoabreu 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 ccf0469  [MXNET-67] Sync master with v1.1.0 branch (#10031)
ccf0469 is described below

commit ccf04698787ff56f9189c0ece6a1a85e2d3876ba
Author: Yizhi Liu 
AuthorDate: Thu Mar 8 15:44:29 2018 -0800

[MXNET-67] Sync master with v1.1.0 branch (#10031)

* [REVIEW REQUIRED] Revert PR #9484 & add additional dependency licenses to 
LICENSE file (#9701)

* Revert "[Review Required] Fixing Licenses: Cleaning up the Top Level 
LICENSE file (#9484)"

This reverts commit 8930d96b265560a797c5554a9617f607cea7740f.

* Some more LICENSE fixes

* Adding some more packages to the LICENSE file

* Adding dependencies of dependencies

* update v1.1.0 change log to NEWS.md

* sync README.md from v1.1.0 branch

* revert to correct jenkins url in README
---
 LICENSE   | 312 +++---
 NEWS.md   |  41 +
 README.md |   1 +
 3 files changed, 320 insertions(+), 34 deletions(-)

diff --git a/LICENSE b/LICENSE
index d3b3d6f..e7d50c3 100644
--- a/LICENSE
+++ b/LICENSE
@@ -201,43 +201,145 @@
See the License for the specific language governing permissions and
limitations under the License.
 
-===
+
==
 Apache MXNET (incubating) Subcomponents:
 
-The Apache MXNET (incubating) project contains subcomponents with separate
-copyright notices and license terms. Your use of the source code for the 
these
+The Apache MXNET (incubating) project contains subcomponents with separate 
copyright
+notices and license terms. Your use of the source code for the these
 subcomponents is subject to the terms and conditions of the following
-licenses -
-
-
-1. Apache-2.0 license as above, wherever applicable
-
-
-
-2. MIT license wherever applicable
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-3. BSD License wherever applicable
-
+licenses.
+
+
===
+Apache-2.0 licenses
+
===
+
+The following components are provided under an Apache 2.0 license.
+
+1. MXNet Cpp-package - For details, /cpp-package/LICENSE
+2. MXNet rcnn - For details, see, example/rcnn/LICENSE
+3. scala-package - For details, see, scala-package/LICENSE
+4. Warp-CTC - For details, see, src/operator/contrib/ctc_include/LICENSE
+5. dlpack - For details, see, dlpack/LICENSE
+6. dmlc-core - For details, see, dmlc-core/LICENSE
+7. mshadow - For details, see, mshadow/LICENSE
+8. nnvm/dmlc-core - For details, see, nnvm/dmlc-core/LICENSE
+9. nnvm - For details, see, nnvm/LICENSE
+10. nnvm-fusion - For details, see, nnvm/plugin/nnvm-fusion/LICENSE
+11. ps-lite - For details, see, ps-lite/LICENSE
+12. nnvm/tvm - For details, see, nnvm/tvm/LICENSE
+13. googlemock scripts/generator - For details, see, 
3rdparty/googletest/googlemock/scripts/generator/LICENSE
+
+

[GitHub] cjolivier01 commented on issue #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on issue #9995: [WIP] CI docker revamp; Add Jetson, 
Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#issuecomment-371663585
 
 
   LGTM


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173327315
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   I don't see any evidence to support that claim, but whatever -- I don't care 
all that much.


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
marcoabreu commented on a change in pull request #9995: [WIP] CI docker revamp; 
Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173325670
 
 

 ##
 File path: python/mxnet/libinfo.py
 ##
 @@ -29,6 +30,17 @@ def find_lib_path():
 lib_path : list(string)
 List of all found path to the libraries.
 """
+lib_from_env = os.environ.get('MXNET_LIBRARY_PATH')
+if lib_from_env:
 
 Review comment:
   The default one below (starting with ``curr_path = 
os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))``)


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] mbaijal closed pull request #10043: [Post 1.1.0] Merge LICENSE file changes from 1.1.0 release

2018-03-08 Thread GitBox
mbaijal closed pull request #10043: [Post 1.1.0] Merge LICENSE file changes 
from 1.1.0 release
URL: https://github.com/apache/incubator-mxnet/pull/10043
 
 
   

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/LICENSE b/LICENSE
index d3b3d6f9dd0..e7d50c37723 100644
--- a/LICENSE
+++ b/LICENSE
@@ -201,43 +201,145 @@
See the License for the specific language governing permissions and
limitations under the License.
 
-===
+
==
 Apache MXNET (incubating) Subcomponents:
 
-The Apache MXNET (incubating) project contains subcomponents with separate
-copyright notices and license terms. Your use of the source code for the 
these
+The Apache MXNET (incubating) project contains subcomponents with separate 
copyright
+notices and license terms. Your use of the source code for the these
 subcomponents is subject to the terms and conditions of the following
-licenses -
-
-
-1. Apache-2.0 license as above, wherever applicable
-
-
-
-2. MIT license wherever applicable
-
-Permission is hereby granted, free of charge, to any person obtaining a
-copy of this software and associated documentation files (the "Software"),
-to deal in the Software without restriction, including without limitation
-the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-
-
-3. BSD License wherever applicable
-
+licenses.
+
+
===
+Apache-2.0 licenses
+
===
+
+The following components are provided under an Apache 2.0 license.
+
+1. MXNet Cpp-package - For details, /cpp-package/LICENSE
+2. MXNet rcnn - For details, see, example/rcnn/LICENSE
+3. scala-package - For details, see, scala-package/LICENSE
+4. Warp-CTC - For details, see, src/operator/contrib/ctc_include/LICENSE
+5. dlpack - For details, see, dlpack/LICENSE
+6. dmlc-core - For details, see, dmlc-core/LICENSE
+7. mshadow - For details, see, mshadow/LICENSE
+8. nnvm/dmlc-core - For details, see, nnvm/dmlc-core/LICENSE
+9. nnvm - For details, see, nnvm/LICENSE
+10. nnvm-fusion - For details, see, nnvm/plugin/nnvm-fusion/LICENSE
+11. ps-lite - For details, see, ps-lite/LICENSE
+12. nnvm/tvm - For details, see, nnvm/tvm/LICENSE
+13. googlemock scripts/generator - For details, see, 
3rdparty/googletest/googlemock/scripts/generator/LICENSE
+
+
+
===
+MIT licenses
+
===
+
+1. Fast R-CNN  - For details, see example/rcnn/LICENSE
+2. Faster R-CNN - For details, see example/rcnn/LICENSE
+3. tree_lstm - For details, see example/gluon/tree_lstm/LICENSE
+4. OpenMP - For details, see 3rdparty/openmp/LICENSE.txt
+5. HalideIR - For details, see nnvm/tvm/HalideIR/LICENSE
+
+
+
===
+NVIDIA Licenses
+
===
+
+1. Moderngpu
+For details, see, 
src/operator/contrib/ctc_include/contrib/moderngpu/LICENSE
+
+

[GitHub] mbaijal commented on issue #10043: [Post 1.1.0] Merge LICENSE file changes from 1.1.0 release

2018-03-08 Thread GitBox
mbaijal commented on issue #10043: [Post 1.1.0] Merge LICENSE file changes from 
1.1.0 release
URL: https://github.com/apache/incubator-mxnet/pull/10043#issuecomment-371660013
 
 
   Closing this since it is a duplicate of PR 
https://github.com/apache/incubator-mxnet/pull/10031


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] mbaijal opened a new pull request #10043: [Post 1.1.0]

2018-03-08 Thread GitBox
mbaijal opened a new pull request #10043: [Post 1.1.0]
URL: https://github.com/apache/incubator-mxnet/pull/10043
 
 
   ## Description ##
   Fixes Issue #9702 
   Apply changes to top Level LICENSE file based on comments from 1.1.0 release
   
   
   ## 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 ###
   - [ ] Updated the LICENSE file to be the same as 1.1.0 branch
   
   


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 #58: Redirect via mod_rewrite

2018-03-08 Thread GitBox
marcoabreu commented on issue #58: Redirect via mod_rewrite
URL: 
https://github.com/apache/incubator-mxnet-site/pull/58#issuecomment-371656409
 
 
   I agree that it's a good solution for the problem in its current form. We
   just have to make sure to note down all requirement and revisit all
   decisions from scratch without being pressured when creating the new system
   
   Aaron Markham  schrieb am Do., 8. M?rz 2018,
   23:50:
   
   > Well, I was planning on incorporating it in the site generation process. I
   > was thinking the s3 solution was just for staging the site and testing it.
   > For production you would want a web server and its features (I would 
think).
   >
   > ?
   > You are receiving this because you modified the open/close state.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or mute the thread
   > 

   > .
   >
   


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 #9774: mx.io.ImageRecordIter does not respect dtype argument / FP16 performance on Volta

2018-03-08 Thread GitBox
rahul003 commented on issue #9774: mx.io.ImageRecordIter does not respect dtype 
argument / FP16 performance on Volta
URL: 
https://github.com/apache/incubator-mxnet/issues/9774#issuecomment-371654013
 
 
   Both suggestions didn't help improve the speed unforunately. Using 
MXNET_CUDNN_AUTOTUNE_DEFAULT=2 helped in some cases. But we can't say this 
setting helps consistently. If it picks the fastest, why would it not help in 
all cases? I understand cases where it should be same speed as other algos. But 
sometimes, this is slower than setting it to 1. All else should remain same, 
right?
   
   I'm writing a tutorial for fp16 usage in MXNet. While doing so, I am trying 
to understand some of the changes you made.
   Here, 
   
https://github.com/apache/incubator-mxnet/blob/649b08665bad016a71fa8b7a29a184d25217e335/example/image-classification/symbols/resnet.py#L141
   Why does softmax input need to be cast to fp32? Is it for precision reasons?
   
   Is that double buffering you mention with identity operator general enough 
to go in as an official guide? 
   
   Thanks for your help :)


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 #9774: mx.io.ImageRecordIter does not respect dtype argument / FP16 performance on Volta

2018-03-08 Thread GitBox
rahul003 commented on issue #9774: mx.io.ImageRecordIter does not respect dtype 
argument / FP16 performance on Volta
URL: 
https://github.com/apache/incubator-mxnet/issues/9774#issuecomment-371654013
 
 
   Both suggestions didn't help improve the speed unforunately. Using 
MXNET_CUDNN_AUTOTUNE_DEFAULT=2 helped in some cases. But we can't say this 
setting helps consistently. If it picks the fastest, why would it not help in 
all cases? I understand cases where it should be same speed as other algos. But 
sometimes, this is slower than setting it to 1. All else should remain same, 
right?
   
   I'm writing a tutorial for fp16 usage in MXNet. While doing so, I am trying 
to understand some of the changes you made.
   Here, 
   
https://github.com/apache/incubator-mxnet/blob/649b08665bad016a71fa8b7a29a184d25217e335/example/image-classification/symbols/resnet.py#L140-143
   Why does softmax input need to be cast to fp32? Is it for precision reasons?
   
   Is that double buffering you mention with identity operator general enough 
to go in as an official guide? 
   
   Thanks for your help :)


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 #9774: mx.io.ImageRecordIter does not respect dtype argument / FP16 performance on Volta

2018-03-08 Thread GitBox
rahul003 commented on issue #9774: mx.io.ImageRecordIter does not respect dtype 
argument / FP16 performance on Volta
URL: 
https://github.com/apache/incubator-mxnet/issues/9774#issuecomment-371654013
 
 
   Both suggestions didn't help improve the speed unforunately. Using 
MXNET_CUDNN_AUTOTUNE_DEFAULT=2 helped in some cases. But we can't say this 
setting helps consistently. If it picks the fastest, why would it not help in 
all cases? I understand cases where it should be same speed as other algos. But 
sometimes, this is slower than setting it to 1. All else should remain same, 
right?
   
   I'm writing a tutorial for fp16 usage in MXNet. While doing so, I am trying 
to understand some of the changes you made.
   Here, 
   
https://github.com/apache/incubator-mxnet/blob/649b08665bad016a71fa8b7a29a184d25217e335/example/image-classification/symbols/resnet.py#L140
   Why does softmax input need to be cast to fp32? Is it for precision reasons?
   
   Is that double buffering you mention with identity operator general enough 
to go in as an official guide? 
   
   Thanks for your help :)


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 #9774: mx.io.ImageRecordIter does not respect dtype argument / FP16 performance on Volta

2018-03-08 Thread GitBox
rahul003 commented on issue #9774: mx.io.ImageRecordIter does not respect dtype 
argument / FP16 performance on Volta
URL: 
https://github.com/apache/incubator-mxnet/issues/9774#issuecomment-371654013
 
 
   Both suggestions didn't help improve the speed unforunately. Using 
MXNET_CUDNN_AUTOTUNE_DEFAULT=2 helped in some cases. But we can't say this 
setting helps consistently. If it picks the fastest, why would it not help in 
all cases? I understand cases where it should be same speed as other algos. But 
sometimes, this is slower than setting it to 1. All else should remain same, 
right?
   
   I'm writing a tutorial for fp16 usage in MXNet. While doing so, I am trying 
to understand some of the changes you made.
   Here, 
   
https://github.com/apache/incubator-mxnet/blob/649b08665bad016a71fa8b7a29a184d25217e335/example/image-classification/symbols/resnet.py#L142
   Why does softmax input need to be cast to fp32? Is it for precision reasons?
   
   Is that double buffering you mention with identity operator general enough 
to go in as an official guide? 
   
   Thanks for your help :)


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 #9774: mx.io.ImageRecordIter does not respect dtype argument / FP16 performance on Volta

2018-03-08 Thread GitBox
rahul003 commented on issue #9774: mx.io.ImageRecordIter does not respect dtype 
argument / FP16 performance on Volta
URL: 
https://github.com/apache/incubator-mxnet/issues/9774#issuecomment-371654013
 
 
   Both suggestions didn't help improve the speed unforunately. Using 
MXNET_CUDNN_AUTOTUNE_DEFAULT=2 helped in some cases. But we can't say this 
setting helps consistently. If it picks the fastest, why would it not help in 
all cases? I understand cases where it should be same speed as other algos. But 
sometimes, this is slower than setting it to 1. All else should remain same, 
right?
   
   I'm writing a tutorial for fp16 usage in MXNet. While doing so, I am trying 
to understand some of the changes you made.
   Here, 
   
https://github.com/apache/incubator-mxnet/blob/649b08665bad016a71fa8b7a29a184d25217e335/example/image-classification/symbols/resnet.py#L143
   Why does softmax input need to be cast to fp32? Is it for precision reasons?
   
   Is that double buffering you mention with identity operator general enough 
to go in as an official guide? 
   
   Thanks for your help :)


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] aaronmarkham commented on issue #58: Redirect via mod_rewrite

2018-03-08 Thread GitBox
aaronmarkham commented on issue #58: Redirect via mod_rewrite
URL: 
https://github.com/apache/incubator-mxnet-site/pull/58#issuecomment-371652299
 
 
   Well, I was planning on incorporating it in the site generation process. I 
was thinking the s3 solution was just for staging the site and testing it. For 
production you would want a web server and its features (I would think).


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 #58: Redirect via mod_rewrite

2018-03-08 Thread GitBox
marcoabreu commented on issue #58: Redirect via mod_rewrite
URL: 
https://github.com/apache/incubator-mxnet-site/pull/58#issuecomment-371650217
 
 
   This entire solution is temporary anyways, considering all these changes
   will be reverted once we turn on website generation
   
   Sheng Zha  schrieb am Do., 8. M?rz 2018, 23:35:
   
   > Usage of .htaccess assumes apache http server. If we migrate to static
   > hosting using s3, a different solution will be needed.
   >
   > ?
   > You are receiving this because you modified the open/close state.
   > Reply to this email directly, view it on GitHub
   > 
,
   > or mute the thread
   > 

   > .
   >
   


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 #58: Redirect via mod_rewrite

2018-03-08 Thread GitBox
szha commented on issue #58: Redirect via mod_rewrite
URL: 
https://github.com/apache/incubator-mxnet-site/pull/58#issuecomment-371648475
 
 
   Usage of  .htaccess assumes apache http server. If we migrate to static 
hosting using s3, a different solution will be needed.


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] haojin2 commented on issue #9715: IndexError in labels when size of training dataset is not multiple of batch size

2018-03-08 Thread GitBox
haojin2 commented on issue #9715: IndexError in labels when size of training 
dataset is not multiple of batch size
URL: 
https://github.com/apache/incubator-mxnet/issues/9715#issuecomment-371643865
 
 
   @nazikus Hello, I tried reproducing your issue with:
   1. Generating a similar dataset with the same number of images (15226 noisy 
images with 3 channels and of size (224, 224)) and running the code snippet you 
provided in "Steps to reproduce" on the dataset.
   2. Creating an MLP model and tried training with the generated dataset on 
the model.
   3. Following the same steps in the fine-tune tutorial 
(https://mxnet.incubator.apache.org/faq/finetune.html) that you used and tried 
training with the generated dataset on the pre-trained model and none of these 
was able to reproduce the bug you reported.
   I wonder if you could give more details on the bug or give access to the 
dataset you were working on so that we may be able to reproduce and fix it? 
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] haojin2 commented on issue #9715: IndexError in labels when size of training dataset is not multiple of batch size

2018-03-08 Thread GitBox
haojin2 commented on issue #9715: IndexError in labels when size of training 
dataset is not multiple of batch size
URL: 
https://github.com/apache/incubator-mxnet/issues/9715#issuecomment-371643865
 
 
   @nazikus Hello, I tried reproducing your issue with:
   0) Generating a similar dataset with the same number of images (15226 noisy 
images with 3 channels and of size (224, 224)) and running the code snippet you 
provided in "Steps to reproduce" on the dataset.
   1) Creating an MLP model and tried training with the generated dataset on 
the model.
   2) Following the same steps in the fine-tune tutorial 
(https://mxnet.incubator.apache.org/faq/finetune.html) that you used and tried 
training with the generated dataset on the pre-trained model and none of these 
was able to reproduce the bug you reported.
   I wonder if you could give more details on the bug or give access to the 
dataset you were working on so that we may be able to reproduce and fix it? 
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] haojin2 commented on issue #9715: IndexError in labels when size of training dataset is not multiple of batch size

2018-03-08 Thread GitBox
haojin2 commented on issue #9715: IndexError in labels when size of training 
dataset is not multiple of batch size
URL: 
https://github.com/apache/incubator-mxnet/issues/9715#issuecomment-371643865
 
 
   @nazikus Hello, I tried reproducing your issue with:
   1 Generating a similar dataset with the same number of images (15226 noisy 
images with 3 channels and of size (224, 224)) and running the code snippet you 
provided in "Steps to reproduce" on the dataset.
   2 Creating an MLP model and tried training with the generated dataset on the 
model.
   3 Following the same steps in the fine-tune tutorial 
(https://mxnet.incubator.apache.org/faq/finetune.html) that you used and tried 
training with the generated dataset on the pre-trained model and none of these 
was able to reproduce the bug you reported.
   I wonder if you could give more details on the bug or give access to the 
dataset you were working on so that we may be able to reproduce and fix it? 
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] haojin2 commented on issue #9715: IndexError in labels when size of training dataset is not multiple of batch size

2018-03-08 Thread GitBox
haojin2 commented on issue #9715: IndexError in labels when size of training 
dataset is not multiple of batch size
URL: 
https://github.com/apache/incubator-mxnet/issues/9715#issuecomment-371643865
 
 
   @nazikus Hello, I tried reproducing your issue with:
   0) Generating a similar dataset with the same number of images (15226 noisy 
images with 3 channels and of size (224, 224)) and running the code snippet you 
provided in "Steps to reproduce" on the dataset.
   2) Creating an MLP model and tried training with the generated dataset on 
the model.
   3) Following the same steps in the fine-tune tutorial 
(https://mxnet.incubator.apache.org/faq/finetune.html) that you used and tried 
training with the generated dataset on the pre-trained model and none of these 
was able to reproduce the bug you reported.
   I wonder if you could give more details on the bug or give access to the 
dataset you were working on so that we may be able to reproduce and fix it? 
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] zheng-da commented on a change in pull request #10025: Language model with Google's billion words dataset

2018-03-08 Thread GitBox
zheng-da commented on a change in pull request #10025: Language model with 
Google's billion words dataset
URL: https://github.com/apache/incubator-mxnet/pull/10025#discussion_r173305447
 
 

 ##
 File path: src/operator/nn/fully_connected.cc
 ##
 @@ -73,22 +76,47 @@ static bool FullyConnectedShape(const nnvm::NodeAttrs& 
attrs,
   return true;
 }
 
-#if MXNET_USE_MKLDNN == 1
 void FullyConnectedComputeExCPU(const nnvm::NodeAttrs& attrs,
 const OpContext ,
 const std::vector ,
 const std::vector ,
 const std::vector ) {
-  if (SupportMKLDNN(inputs[0])) {
-MKLDNN_OPCHECK_INIT(false, outputs.size(), inputs, outputs);
-MKLDNNFCForward(attrs, ctx, inputs, req, outputs);
-MKLDNN_OPCHECK_RUN(FullyConnectedCompute, attrs, ctx, inputs, req,
-   outputs);
+  const FullyConnectedParam& param = 
nnvm::get(attrs.parsed);
+  const bool valid_data = inputs[0].storage_type() == kDefaultStorage;
+  const bool valid_weight = inputs[1].storage_type() == kDefaultStorage ||
+inputs[1].storage_type() == kRowSparseStorage;
+  const bool valid_out = outputs[0].storage_type() == kDefaultStorage;
+  bool valid_bias = true;
+  if (!param.no_bias) {
+valid_bias = inputs[2].storage_type() == kDefaultStorage ||
+ inputs[2].storage_type() == kRowSparseStorage;
+  }
+#if MXNET_USE_MKLDNN == 1
+  if (common::ContainsOnlyStorage(inputs, kDefaultStorage) &&
+  common::ContainsOnlyStorage(outputs, kDefaultStorage)) {
+if (SupportMKLDNN(inputs[0])) {
+  MKLDNN_OPCHECK_INIT(false, outputs.size(), inputs, outputs);
+  MKLDNNFCForward(attrs, ctx, inputs, req, outputs);
+  MKLDNN_OPCHECK_RUN(FullyConnectedCompute, attrs, ctx, inputs, req,
+ outputs);
+} else {
+  FallBackCompute(FullyConnectedCompute, attrs, ctx, inputs, req, 
outputs);
+}
 return;
   }
-  FallBackCompute(FullyConnectedCompute, attrs, ctx, inputs, req, 
outputs);
+#endif
+  if (valid_data && valid_weight && valid_bias && valid_out) {
+std::vector in_blobs(inputs.size());
+for (size_t i = 0; i < in_blobs.size(); i++) in_blobs[i] = 
inputs[i].data();
 
 Review comment:
   Actually, if an NDArray uses MKLDNN format, data() will convert its layout 
inside the array. This caused a race condition, I just fixed. You shouldn't 
call data() on an NDArray with MKLDNN format. Please check FallBackCompute to 
see how it is handled correctly.
   
   I also don't understand what happens if the input array is a row sparse. If 
the row sparse array doesn't have zero-entry rows, it works fine. What is the 
row sparse array have zero-entry rows, isn't the memory returned from data() is 
smaller than we expect?


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: [WIP] [MXNET-33] Mkldnn pooling convention crash

2018-03-08 Thread GitBox
ashokei commented on issue #10021: [WIP] [MXNET-33] Mkldnn pooling convention 
crash
URL: https://github.com/apache/incubator-mxnet/pull/10021#issuecomment-371638503
 
 
   @marcoabreu @TaoLv @zheng-da Unit-tests currently do not seem to test 
backward/training mode for pooling very well. Below is the test for reproducing 
this crash.
   
   
   > cd example/image-classification/symbols/
 ln -s ../../ssd/symbol/vgg16_reduced.py vgg16_reduced.py
 cd ../../..
 python example/image-classification/train_cifar10.py --network 
vgg16_reduced
   
   
   This PR will fix the above crash.
   


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: [WIP] [MXNET-33] Mkldnn pooling convention crash

2018-03-08 Thread GitBox
ashokei commented on issue #10021: [WIP] [MXNET-33] Mkldnn pooling convention 
crash
URL: https://github.com/apache/incubator-mxnet/pull/10021#issuecomment-371638503
 
 
   @marcoabreu @TaoLv @zheng-da Unit-tests currently do not seem to test 
backward/training mode for pooling very well. Below is the test for reproducing 
this crash.
   
   `
   cd example/image-classification/symbols/
   ln -s ../../ssd/symbol/vgg16_reduced.py vgg16_reduced.py
   cd ../../..
   python example/image-classification/train_cifar10.py --network vgg16_reduced
   `
   
   This PR will fix the above crash.
   


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 #9986: gluon language modeling dataset and text token reader

2018-03-08 Thread GitBox
szha commented on issue #9986: gluon language modeling dataset and text token 
reader
URL: https://github.com/apache/incubator-mxnet/pull/9986#issuecomment-371637476
 
 
   Also, for large dataset it might be worth changing to store indices-only. 
Need to explore more.


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 #10042: Gluon dataloader crash on speech recognition training

2018-03-08 Thread GitBox
sxjscience commented on issue #10042: Gluon dataloader crash on speech 
recognition training
URL: 
https://github.com/apache/incubator-mxnet/issues/10042#issuecomment-371636821
 
 
   Thanks for reporting! Is there any code to reproduce the error message?


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 nlp_toolkit updated: gluon language modeling dataset and text token reader (#9986)

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

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


The following commit(s) were added to refs/heads/nlp_toolkit by this push:
 new 329acde  gluon language modeling dataset and text token reader (#9986)
329acde is described below

commit 329acde5a722f7be44604dd601884592945755e1
Author: Sheng Zha 
AuthorDate: Thu Mar 8 16:49:51 2018 -0500

gluon language modeling dataset and text token reader (#9986)

* language modeling dataset and text token reader.

* update

* add padding

* update bos insert

* update doc
---
 example/gluon/word_language_model/train.py |  44 ---
 python/mxnet/gluon/data/__init__.py|   2 +
 .../gluon/data/{__init__.py => datareader.py}  |  18 ++-
 python/mxnet/gluon/data/{ => text}/__init__.py |  10 +-
 .../gluon/data/{__init__.py => text/_constants.py} |  12 +-
 python/mxnet/gluon/data/text/base.py   | 103 +++
 python/mxnet/gluon/data/text/lm.py | 145 +
 python/mxnet/gluon/data/text/utils.py  |  73 +++
 tests/python/unittest/test_gluon_data_text.py  |  50 +++
 9 files changed, 420 insertions(+), 37 deletions(-)

diff --git a/example/gluon/word_language_model/train.py 
b/example/gluon/word_language_model/train.py
index b69fd17..c732393 100644
--- a/example/gluon/word_language_model/train.py
+++ b/example/gluon/word_language_model/train.py
@@ -16,13 +16,13 @@
 # under the License.
 
 import argparse
+import collections
 import time
 import math
 import mxnet as mx
-from mxnet import gluon, autograd
-from mxnet.gluon import contrib
+from mxnet import gluon, autograd, contrib
+from mxnet.gluon import data
 import model
-import data
 
 parser = argparse.ArgumentParser(description='MXNet Autograd RNN/LSTM Language 
Model on Wikitext-2.')
 parser.add_argument('--model', type=str, default='lstm',
@@ -71,32 +71,40 @@ if args.cuda:
 else:
 context = mx.cpu(0)
 
-train_dataset = contrib.data.text.WikiText2('./data', 'train', 
seq_len=args.bptt)
-vocab = train_dataset.vocabulary
-val_dataset, test_dataset = [contrib.data.text.WikiText2('./data', segment,
- vocab=vocab,
- seq_len=args.bptt)
- for segment in ['validation', 'test']]
+train_dataset = data.text.lm.WikiText2('./data', 'train', seq_len=args.bptt,
+   eos='')
+
+def get_frequencies(dataset):
+return collections.Counter(x for tup in dataset for x in tup[0] if x)
+
+vocab = contrib.text.vocab.Vocabulary(get_frequencies(train_dataset))
+def index_tokens(data, label):
+return vocab.to_indices(data), vocab.to_indices(label)
+
+val_dataset, test_dataset = [data.text.lm.WikiText2('./data', segment,
+seq_len=args.bptt,
+eos='')
+ for segment in ['val', 'test']]
 
 nbatch_train = len(train_dataset) // args.batch_size
-train_data = gluon.data.DataLoader(train_dataset,
+train_data = gluon.data.DataLoader(train_dataset.transform(index_tokens),
batch_size=args.batch_size,
-   
sampler=contrib.data.IntervalSampler(len(train_dataset),
-
nbatch_train),
+   
sampler=gluon.contrib.data.IntervalSampler(len(train_dataset),
+  
nbatch_train),
last_batch='discard')
 
 nbatch_val = len(val_dataset) // args.batch_size
-val_data = gluon.data.DataLoader(val_dataset,
+val_data = gluon.data.DataLoader(val_dataset.transform(index_tokens),
  batch_size=args.batch_size,
- 
sampler=contrib.data.IntervalSampler(len(val_dataset),
-  
nbatch_val),
+ 
sampler=gluon.contrib.data.IntervalSampler(len(val_dataset),
+
nbatch_val),
  last_batch='discard')
 
 nbatch_test = len(test_dataset) // args.batch_size
-test_data = gluon.data.DataLoader(test_dataset,
+test_data = gluon.data.DataLoader(test_dataset.transform(index_tokens),
   batch_size=args.batch_size,
-  
sampler=contrib.data.IntervalSampler(len(test_dataset),
-   
nbatch_test),
+

[GitHub] sxjscience closed pull request #9986: gluon language modeling dataset and text token reader

2018-03-08 Thread GitBox
sxjscience closed pull request #9986: gluon language modeling dataset and text 
token reader
URL: https://github.com/apache/incubator-mxnet/pull/9986
 
 
   

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/example/gluon/word_language_model/train.py 
b/example/gluon/word_language_model/train.py
index b69fd173200..c7323934a13 100644
--- a/example/gluon/word_language_model/train.py
+++ b/example/gluon/word_language_model/train.py
@@ -16,13 +16,13 @@
 # under the License.
 
 import argparse
+import collections
 import time
 import math
 import mxnet as mx
-from mxnet import gluon, autograd
-from mxnet.gluon import contrib
+from mxnet import gluon, autograd, contrib
+from mxnet.gluon import data
 import model
-import data
 
 parser = argparse.ArgumentParser(description='MXNet Autograd RNN/LSTM Language 
Model on Wikitext-2.')
 parser.add_argument('--model', type=str, default='lstm',
@@ -71,32 +71,40 @@
 else:
 context = mx.cpu(0)
 
-train_dataset = contrib.data.text.WikiText2('./data', 'train', 
seq_len=args.bptt)
-vocab = train_dataset.vocabulary
-val_dataset, test_dataset = [contrib.data.text.WikiText2('./data', segment,
- vocab=vocab,
- seq_len=args.bptt)
- for segment in ['validation', 'test']]
+train_dataset = data.text.lm.WikiText2('./data', 'train', seq_len=args.bptt,
+   eos='')
+
+def get_frequencies(dataset):
+return collections.Counter(x for tup in dataset for x in tup[0] if x)
+
+vocab = contrib.text.vocab.Vocabulary(get_frequencies(train_dataset))
+def index_tokens(data, label):
+return vocab.to_indices(data), vocab.to_indices(label)
+
+val_dataset, test_dataset = [data.text.lm.WikiText2('./data', segment,
+seq_len=args.bptt,
+eos='')
+ for segment in ['val', 'test']]
 
 nbatch_train = len(train_dataset) // args.batch_size
-train_data = gluon.data.DataLoader(train_dataset,
+train_data = gluon.data.DataLoader(train_dataset.transform(index_tokens),
batch_size=args.batch_size,
-   
sampler=contrib.data.IntervalSampler(len(train_dataset),
-
nbatch_train),
+   
sampler=gluon.contrib.data.IntervalSampler(len(train_dataset),
+  
nbatch_train),
last_batch='discard')
 
 nbatch_val = len(val_dataset) // args.batch_size
-val_data = gluon.data.DataLoader(val_dataset,
+val_data = gluon.data.DataLoader(val_dataset.transform(index_tokens),
  batch_size=args.batch_size,
- 
sampler=contrib.data.IntervalSampler(len(val_dataset),
-  
nbatch_val),
+ 
sampler=gluon.contrib.data.IntervalSampler(len(val_dataset),
+
nbatch_val),
  last_batch='discard')
 
 nbatch_test = len(test_dataset) // args.batch_size
-test_data = gluon.data.DataLoader(test_dataset,
+test_data = gluon.data.DataLoader(test_dataset.transform(index_tokens),
   batch_size=args.batch_size,
-  
sampler=contrib.data.IntervalSampler(len(test_dataset),
-   
nbatch_test),
+  
sampler=gluon.contrib.data.IntervalSampler(len(test_dataset),
+ 
nbatch_test),
   last_batch='discard')
 
 
diff --git a/python/mxnet/gluon/data/__init__.py 
b/python/mxnet/gluon/data/__init__.py
index 23ae3e9b3be..14a0e46d7fe 100644
--- a/python/mxnet/gluon/data/__init__.py
+++ b/python/mxnet/gluon/data/__init__.py
@@ -26,3 +26,5 @@
 from .dataloader import *
 
 from . import vision
+
+from . import text
diff --git a/python/mxnet/gluon/data/datareader.py 
b/python/mxnet/gluon/data/datareader.py
new file mode 100644
index 000..9b94ed46838
--- /dev/null
+++ b/python/mxnet/gluon/data/datareader.py
@@ -0,0 +1,34 @@
+# 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.  

[GitHub] szha commented on issue #9986: gluon language modeling dataset and text token reader

2018-03-08 Thread GitBox
szha commented on issue #9986: gluon language modeling dataset and text token 
reader
URL: https://github.com/apache/incubator-mxnet/pull/9986#issuecomment-371630223
 
 
   Discussed offline on the design, and it would be worth having a data reader 
that returns raw sentences to facilitate use cases like skip-thought. We will 
separate out that part of logic from the WordLanguageReader into a parent class 
as soon as we get to such use case (e.g. MT)


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] jeremiedb commented on issue #10038: MxNet with R on Windows : DiagrammeR dependency isn't resolved properly

2018-03-08 Thread GitBox
jeremiedb commented on issue #10038: MxNet with R on Windows : DiagrammeR 
dependency isn't resolved properly
URL: 
https://github.com/apache/incubator-mxnet/issues/10038#issuecomment-371629153
 
 
   DiagrammeR 1.0.0 brought on incompatibility with the graph.viz. This has 
been fixed in the master, but creates issues with the Windows pre-compiled 
packages that haven't been updated for a while. 
   
   Winodws CPU package of Mxnet 1.2.0 which includes the patch can be 
downloaded here: 
   
`install.packages("https://github.com/jeremiedb/mxnet_winbin/raw/master/mxnet.zip;,
 repos = NULL)`
   
   Not sure if this version could be uploaded to the official mxnet repo?


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173294247
 
 

 ##
 File path: CMakeLists.txt
 ##
 @@ -94,7 +95,13 @@ else(MSVC)
   endif()
   check_cxx_compiler_flag("-std=c++11"   SUPPORT_CXX11)
   check_cxx_compiler_flag("-std=c++0x"   SUPPORT_CXX0X)
-  check_cxx_compiler_flag("-msse2"   SUPPORT_MSSE2)
+  # For cross compilation, we can't rely on the compiler which accepts the 
flag, but mshadow will
+  # add platform specific includes not available in other arches
+  if(USE_SSE STREQUAL "AUTO")
+check_cxx_compiler_flag("-msse2"   SUPPORT_MSSE2)
+  else()
+set(SUPPORT_MSSE2 "OFF")
 
 Review comment:
   Please use unset(SUPPORT_MSSE) or set to FALSE (no quotes)


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 #9995: [WIP] CI docker revamp; Add Jetson, Raspberry and CentOS 7 build [MXNET-42][MXNET-43][MXNET-44][MXNET-57]

2018-03-08 Thread GitBox
cjolivier01 commented on a change in pull request #9995: [WIP] CI docker 
revamp; Add Jetson, Raspberry and CentOS 7 build 
[MXNET-42][MXNET-43][MXNET-44][MXNET-57]
URL: https://github.com/apache/incubator-mxnet/pull/9995#discussion_r173294029
 
 

 ##
 File path: CMakeLists.txt
 ##
 @@ -94,7 +95,13 @@ else(MSVC)
   endif()
   check_cxx_compiler_flag("-std=c++11"   SUPPORT_CXX11)
   check_cxx_compiler_flag("-std=c++0x"   SUPPORT_CXX0X)
-  check_cxx_compiler_flag("-msse2"   SUPPORT_MSSE2)
+  # For cross compilation, we can't rely on the compiler which accepts the 
flag, but mshadow will
+  # add platform specific includes not available in other arches
+  if(USE_SSE STREQUAL "AUTO")
+check_cxx_compiler_flag("-msse2"   SUPPORT_MSSE2)
 
 Review comment:
   nit: the spacing before SUPPORT_MSSE2 becomes kind of pointless if the 
check_cxx_compiler_flag(...) line isn;t still aligned with the rest of them


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 opened a new issue #10042: Gluon dataloader crash on speech recognition training

2018-03-08 Thread GitBox
Jerryzcn opened a new issue #10042: Gluon dataloader crash on speech 
recognition training
URL: https://github.com/apache/incubator-mxnet/issues/10042
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues and bug reports. For non-technical 
issues and feature requests, feel free to present the information in what you 
believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at 
https://discuss.mxnet.io 
   
   ## Description
   (Brief description of the problem in no more than 2 sentences.)
   Gluon data loader crash during training.
   
   ## Environment info (Required)
   
   ```
   What to do:
   1. Download the diagnosis script from 
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   2. Run the script using `python diagnose.py` and paste its output here.
   --Python Info--
   Version  : 3.6.3
   Compiler : GCC 7.2.0
   Build: ('default', 'Oct 13 2017 12:02:49')
   Arch : ('64bit', '')
   Pip Info---
   Version  : 9.0.1
   Directory: /home/ubuntu/anaconda3/lib/python3.6/site-packages/pip
   --MXNet Info---
   /home/ubuntu/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:34: 
FutureWarning: Conversion of the second argument of issubdtype from `float` to 
`np.floating` is deprecated. In future, it will be treated as `np.float64 == 
np.dtype(float).type`.
 from ._conv import register_converters as _register_converters
   
/home/ubuntu/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py:46:
 DeprecationWarning: OpenSSL.rand is deprecated - you should use os.urandom 
instead
 import OpenSSL.SSL
   Version  : 1.2.0
   Directory: 
/home/ubuntu/anaconda3/lib/python3.6/site-packages/mxnet-1.2.0-py3.6.egg/mxnet
   Hashtag not found. Not installed from pre-built package.
   --System Info--
   Platform : Linux-4.4.0-1052-aws-x86_64-with-debian-stretch-sid
   system   : Linux
   node : ip-172-31-22-177
   release  : 4.4.0-1052-aws
   version  : #61-Ubuntu SMP Mon Feb 12 23:05:58 UTC 2018
   --Hardware Info--
   machine  : x86_64
   processor: x86_64
   Architecture:  x86_64
   CPU op-mode(s):32-bit, 64-bit
   Byte Order:Little Endian
   CPU(s):64
   On-line CPU(s) list:   0-63
   Thread(s) per core:2
   Core(s) per socket:16
   Socket(s): 2
   NUMA node(s):  2
   Vendor ID: GenuineIntel
   CPU family:6
   Model: 79
   Model name:Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
   Stepping:  1
   CPU MHz:   2699.984
   CPU max MHz:   3000.
   CPU min MHz:   1200.
   BogoMIPS:  4600.07
   Hypervisor vendor: Xen
   Virtualization type:   full
   L1d cache: 32K
   L1i cache: 32K
   L2 cache:  256K
   L3 cache:  46080K
   NUMA node0 CPU(s): 0-15,32-47
   NUMA node1 CPU(s): 16-31,48-63
   Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm 
constant_tsc arch_perfmon rep_good nopl xtopology nonstop_tsc aperfmperf 
eagerfpu pni pclmulqdq monitor est ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic 
movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm 
abm 3dnowprefetch invpcid_single retpoline kaiser fsgsbase bmi1 hle avx2 smep 
bmi2 erms invpcid rtm rdseed adx xsaveopt ida
   --Network Test--
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0022 
sec, LOAD: 0.5053 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.1427 sec, LOAD: 
0.0642 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.1806 sec, LOAD: 
0.1844 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
 DNS: 0.0252 sec, LOAD: 0.1844 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0117 sec, LOAD: 
0.2449 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0081 sec, 
LOAD: 0.3814 sec.
   ```
   
   Package used (Python/R/Scala/Julia):
   I'm using Python
   
   For Scala user, please provide:
   1. Java version: (`java -version`)
   2. Maven version: (`mvn -version`)
   3. Scala runtime if applicable: (`scala -version`)
   
   For R user, please provide R `sessionInfo()`:
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   ```
   gcc -v
   Using built-in specs.
   COLLECT_GCC=gcc
   COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper

[GitHub] sxjscience commented on issue #10019: ModuleNotFoundError

2018-03-08 Thread GitBox
sxjscience commented on issue #10019: ModuleNotFoundError
URL: 
https://github.com/apache/incubator-mxnet/issues/10019#issuecomment-371623118
 
 
   I think you may need to install the cython pacakge in the RCNN folder 
https://github.com/apache/incubator-mxnet/tree/master/example/rcnn/rcnn/cython


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 #10035: Who can help me solve this error??batch_loss.backward() error?

2018-03-08 Thread GitBox
sxjscience commented on issue #10035: Who can help me solve this 
error??batch_loss.backward()  error?
URL: 
https://github.com/apache/incubator-mxnet/issues/10035#issuecomment-371622551
 
 
   The for-loop here should be the problem
   ```python
   for step in range(...):
  ...
   ```
   We can revise it to be a single phrase, i.e,
   ```python
   batch_loss = nd.mean(softmax_cross_entropy(logits, one_hot_label))
   ```
   If you still cannot solve it, you can post the codes here (instead of 
images) and I will help you debug.


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 #9977: Cpu lstm inference

2018-03-08 Thread GitBox
Jerryzcn commented on issue #9977: Cpu lstm inference
URL: https://github.com/apache/incubator-mxnet/pull/9977#issuecomment-371608311
 
 
   ```
   x = nd.ones(shape=(800,1,40))
   model = mx.gluon.nn.Sequential()
   with model.name_scope():
   model.add(mx.gluon.rnn.LSTM(320, num_layers=4, bidirectional=True))
   model.initialize(mx.init.One())
   for i in range(3):
   y = model(x).asnumpy()
   print(i)
   
   t = time.time()
   for i in range(10):
   y = model(x).asnumpy()
   print(i)
   print("avg time:", (time.time() - t)/10.0)
   ```


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 #10038: MxNet with R on Windows : DiagrammeR dependency isn't resolved properly

2018-03-08 Thread GitBox
sxjscience commented on issue #10038: MxNet with R on Windows : DiagrammeR 
dependency isn't resolved properly
URL: 
https://github.com/apache/incubator-mxnet/issues/10038#issuecomment-371620482
 
 
   @nswamy @jeremiedb 


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 nlp_toolkit updated (29f7f43 -> 649b086)

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

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


from 29f7f43  gluon dataset download refactor (#10008)
 add 2a9c7d9  [Perl] Sparse feature. (#9988)
 add 0fe04e9  add SameType as default type inference function in imperative 
mode (#9942)
 add 098c9d9  add name (#10007)
 add 117c509  Fix bug for Dropout with axes, also adding unit test (#10030)
 add 39c0fd8  Fix ndarray assignment issue with basic indexing (#10022)
 add 7b4594d  Update an incorrect description in the API doc.  (#10034)
 add c162c9d  update namespace (#10036)
 add c3f7961  correct resnet link in model zoo page (#10033)
 add f04edb5  [MXNET-31] Support variable sequence length in 
gluon.RecurrentCell  (#9934)
 add 649b086  add axes support for dropouts in gluon (#10032)

No new revisions were added by this update.

Summary of changes:
 CONTRIBUTORS.md|6 +-
 docker/install/perl.sh |2 +-
 docker_multiarch/Dockerfile.run.ubuntu-17.04.perl  |2 +-
 docs/api/perl/index.md |5 +-
 docs/install/build_from_source.md  |2 +-
 docs/install/osx_setup.md  |2 +-
 docs/install/ubuntu_setup.md   |2 +-
 perl-package/AI-MXNet/Changes  |3 +
 perl-package/AI-MXNet/MANIFEST |   10 +
 perl-package/AI-MXNet/META.json|9 +-
 perl-package/AI-MXNet/META.yml |7 +-
 perl-package/AI-MXNet/Makefile.PL  |   12 +-
 perl-package/AI-MXNet/README   |2 +-
 .../sparse/matrix_factorization/README.md  |7 +-
 .../sparse/matrix_factorization/get_data.sh|   15 +-
 .../examples/sparse/matrix_factorization/train.pl  |  184 +++
 .../AI-MXNet/examples}/sparse/wide_deep/README.md  |4 +-
 .../AI-MXNet/examples/sparse/wide_deep/get_data.sh |   17 +-
 .../AI-MXNet/examples/sparse/wide_deep/train.pl|  301 +
 perl-package/AI-MXNet/lib/AI/MXNet.pm  |5 +-
 perl-package/AI-MXNet/lib/AI/MXNet/AutoGrad.pm |2 +-
 perl-package/AI-MXNet/lib/AI/MXNet/Base.pm |  131 +-
 perl-package/AI-MXNet/lib/AI/MXNet/CachedOp.pm |4 +-
 perl-package/AI-MXNet/lib/AI/MXNet/Executor.pm |2 +-
 perl-package/AI-MXNet/lib/AI/MXNet/IO.pm   |   23 +-
 perl-package/AI-MXNet/lib/AI/MXNet/KVStore.pm  |  168 ++-
 perl-package/AI-MXNet/lib/AI/MXNet/Module.pm   |8 +-
 perl-package/AI-MXNet/lib/AI/MXNet/Module/Base.pm  |6 +-
 perl-package/AI-MXNet/lib/AI/MXNet/Monitor.pm  |2 +-
 perl-package/AI-MXNet/lib/AI/MXNet/NDArray.pm  |   96 +-
 perl-package/AI-MXNet/lib/AI/MXNet/NDArray/Base.pm |   43 +-
 .../AI-MXNet/lib/AI/MXNet/NDArray/Sparse.pm| 1342 
 perl-package/AI-MXNet/lib/AI/MXNet/Optimizer.pm|  743 +--
 perl-package/AI-MXNet/lib/AI/MXNet/Symbol.pm   |   40 +-
 perl-package/AI-MXNet/lib/AI/MXNet/Symbol/Base.pm  |2 +-
 .../MXNet/{Contrib/NDArray.pm => Symbol/Sparse.pm} |   11 +-
 perl-package/AI-MXNet/lib/AI/MXNet/TestUtils.pm|  456 ++-
 perl-package/AI-MXNet/lib/AI/MXNet/Types.pm|   12 +-
 perl-package/AI-MXNet/t/test_autograd.t|  105 +-
 perl-package/AI-MXNet/t/test_init.t|   24 +-
 perl-package/AI-MXNet/t/test_io.t  |   48 +-
 perl-package/AI-MXNet/t/test_kvstore.t |   93 +-
 perl-package/AI-MXNet/t/test_module.t  |  257 +++-
 perl-package/AI-MXNet/t/test_optimizers.t  |  629 -
 perl-package/AI-MXNet/t/test_sparse_ndarray.t  | 1005 +++
 perl-package/AI-MXNetCAPI/Changes  |3 +
 perl-package/AI-MXNetCAPI/META.json|2 +-
 perl-package/AI-MXNetCAPI/META.yml |2 +-
 perl-package/AI-MXNetCAPI/README   |2 +-
 perl-package/AI-MXNetCAPI/lib/AI/MXNetCAPI.pm  |2 +-
 perl-package/AI-MXNetCAPI/mxnet.i  |  216 +++-
 perl-package/AI-MXNetCAPI/mxnet_typemaps.i |   45 +-
 perl-package/AI-NNVMCAPI/Changes   |3 +
 perl-package/AI-NNVMCAPI/META.json |2 +-
 perl-package/AI-NNVMCAPI/META.yml  |2 +-
 perl-package/AI-NNVMCAPI/README|2 +-
 perl-package/AI-NNVMCAPI/lib/AI/NNVMCAPI.pm|2 +-
 perl-package/README.md |5 +-
 python/mxnet/gluon/contrib/data/text.py|3 +-
 python/mxnet/gluon/contrib/rnn/rnn_cell.py |   36 +-
 python/mxnet/gluon/data/vision/datasets.py |8 +-
 python/mxnet/gluon/model_zoo/vision/__init__.py|2 +-
 python/mxnet/gluon/nn/basic_layers.py  |9 +-
 python/mxnet/gluon/rnn/rnn_cell.py  

[GitHub] sxjscience closed pull request #10032: add axes support for dropouts in gluon

2018-03-08 Thread GitBox
sxjscience closed pull request #10032: add axes support for dropouts in gluon
URL: https://github.com/apache/incubator-mxnet/pull/10032
 
 
   

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/python/mxnet/gluon/contrib/rnn/rnn_cell.py 
b/python/mxnet/gluon/contrib/rnn/rnn_cell.py
index d6402b769cb..b964c712ace 100644
--- a/python/mxnet/gluon/contrib/rnn/rnn_cell.py
+++ b/python/mxnet/gluon/contrib/rnn/rnn_cell.py
@@ -180,16 +180,12 @@ def unroll(self, length, inputs, begin_state=None, 
layout='NTC', merge_outputs=N
 states = _get_begin_state(self, F, begin_state, inputs, batch_size)
 
 if self.drop_inputs:
-first_input = inputs.slice_axis(axis, 0, 1).split(1, axis=axis, 
squeeze_axis=True)
-self._initialize_input_masks(F, first_input, states)
-inputs = F.broadcast_mul(inputs, 
self.drop_inputs_mask.expand_dims(axis=axis))
+inputs = F.Dropout(inputs, p=self.drop_inputs, axes=(axis,))
 
 outputs, states = self.base_cell.unroll(length, inputs, states, 
layout, merge_outputs=True,
 valid_length=valid_length)
 if self.drop_outputs:
-first_output = outputs.slice_axis(axis, 0, 1).split(1, axis=axis, 
squeeze_axis=True)
-self._initialize_output_mask(F, first_output)
-outputs = F.broadcast_mul(outputs, 
self.drop_outputs_mask.expand_dims(axis=axis))
+outputs = F.Dropout(outputs, p=self.drop_outputs, axes=(axis,))
 merge_outputs = isinstance(outputs, tensor_types) if merge_outputs is 
None else \
 merge_outputs
 outputs, _, _, _ = _format_sequence(length, outputs, layout, 
merge_outputs)
diff --git a/python/mxnet/gluon/nn/basic_layers.py 
b/python/mxnet/gluon/nn/basic_layers.py
index b61540dd61b..9dc1a240681 100644
--- a/python/mxnet/gluon/nn/basic_layers.py
+++ b/python/mxnet/gluon/nn/basic_layers.py
@@ -226,6 +226,8 @@ class Dropout(HybridBlock):
 --
 rate : float
 Fraction of the input units to drop. Must be a number between 0 and 1.
+axes : tuple of int, default ()
+The axes on which dropout mask is shared. If empty, regular dropout is 
applied.
 
 
 Inputs:
@@ -239,15 +241,16 @@ class Dropout(HybridBlock):
 `Dropout: A Simple Way to Prevent Neural Networks from Overfitting
 `_
 """
-def __init__(self, rate, **kwargs):
+def __init__(self, rate, axes=(), **kwargs):
 super(Dropout, self).__init__(**kwargs)
 self._rate = rate
+self._axes = axes
 
 def hybrid_forward(self, F, x):
-return F.Dropout(x, p=self._rate, name='fwd')
+return F.Dropout(x, p=self._rate, axes=self._axes, name='fwd')
 
 def __repr__(self):
-s = '{name}(p = {_rate})'
+s = '{name}(p = {_rate}, axes={_axes})'
 return s.format(name=self.__class__.__name__,
 **self.__dict__)
 
diff --git a/python/mxnet/gluon/rnn/rnn_cell.py 
b/python/mxnet/gluon/rnn/rnn_cell.py
index 61bf24e8cd1..f5c72f5f3e7 100644
--- a/python/mxnet/gluon/rnn/rnn_cell.py
+++ b/python/mxnet/gluon/rnn/rnn_cell.py
@@ -713,6 +713,8 @@ class DropoutCell(HybridRecurrentCell):
 rate : float
 Percentage of elements to drop out, which
 is 1 - percentage to retain.
+axes : tuple of int, default ()
+The axes on which dropout mask is shared. If empty, regular dropout is 
applied.
 
 
 Inputs:
@@ -723,13 +725,14 @@ class DropoutCell(HybridRecurrentCell):
 - **out**: output tensor with shape `(batch_size, size)`.
 - **next_states**: returns input `states` directly.
 """
-def __init__(self, rate, prefix=None, params=None):
+def __init__(self, rate, axes=(), prefix=None, params=None):
 super(DropoutCell, self).__init__(prefix, params)
 assert isinstance(rate, numeric_types), "rate must be a number"
-self.rate = rate
+self._rate = rate
+self._axes = axes
 
 def __repr__(self):
-s = '{name}(rate = {rate})'
+s = '{name}(rate={_rate}, axes={_axes})'
 return s.format(name=self.__class__.__name__,
 **self.__dict__)
 
@@ -740,8 +743,9 @@ def _alias(self):
 return 'dropout'
 
 def hybrid_forward(self, F, inputs, states):
-if self.rate > 0:
-inputs = F.Dropout(data=inputs, p=self.rate, 
name='t%d_fwd'%self._counter)
+if self._rate > 0:
+inputs = F.Dropout(data=inputs, p=self._rate, axes=self._axes,
+   name='t%d_fwd'%self._counter)
 return inputs, states
 
 def unroll(self, length, inputs, begin_state=None, 

[incubator-mxnet] branch master updated: add axes support for dropouts in gluon (#10032)

2018-03-08 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 649b086  add axes support for dropouts in gluon (#10032)
649b086 is described below

commit 649b08665bad016a71fa8b7a29a184d25217e335
Author: Sheng Zha 
AuthorDate: Thu Mar 8 15:46:47 2018 -0500

add axes support for dropouts in gluon (#10032)
---
 python/mxnet/gluon/contrib/rnn/rnn_cell.py  |  8 ++
 python/mxnet/gluon/nn/basic_layers.py   |  9 ---
 python/mxnet/gluon/rnn/rnn_cell.py  | 14 ++
 tests/python/unittest/test_gluon.py | 40 +
 tests/python/unittest/test_gluon_contrib.py |  3 ---
 tests/python/unittest/test_operator.py  | 29 +++--
 6 files changed, 72 insertions(+), 31 deletions(-)

diff --git a/python/mxnet/gluon/contrib/rnn/rnn_cell.py 
b/python/mxnet/gluon/contrib/rnn/rnn_cell.py
index d6402b7..b964c71 100644
--- a/python/mxnet/gluon/contrib/rnn/rnn_cell.py
+++ b/python/mxnet/gluon/contrib/rnn/rnn_cell.py
@@ -180,16 +180,12 @@ class VariationalDropoutCell(ModifierCell):
 states = _get_begin_state(self, F, begin_state, inputs, batch_size)
 
 if self.drop_inputs:
-first_input = inputs.slice_axis(axis, 0, 1).split(1, axis=axis, 
squeeze_axis=True)
-self._initialize_input_masks(F, first_input, states)
-inputs = F.broadcast_mul(inputs, 
self.drop_inputs_mask.expand_dims(axis=axis))
+inputs = F.Dropout(inputs, p=self.drop_inputs, axes=(axis,))
 
 outputs, states = self.base_cell.unroll(length, inputs, states, 
layout, merge_outputs=True,
 valid_length=valid_length)
 if self.drop_outputs:
-first_output = outputs.slice_axis(axis, 0, 1).split(1, axis=axis, 
squeeze_axis=True)
-self._initialize_output_mask(F, first_output)
-outputs = F.broadcast_mul(outputs, 
self.drop_outputs_mask.expand_dims(axis=axis))
+outputs = F.Dropout(outputs, p=self.drop_outputs, axes=(axis,))
 merge_outputs = isinstance(outputs, tensor_types) if merge_outputs is 
None else \
 merge_outputs
 outputs, _, _, _ = _format_sequence(length, outputs, layout, 
merge_outputs)
diff --git a/python/mxnet/gluon/nn/basic_layers.py 
b/python/mxnet/gluon/nn/basic_layers.py
index b61540d..9dc1a24 100644
--- a/python/mxnet/gluon/nn/basic_layers.py
+++ b/python/mxnet/gluon/nn/basic_layers.py
@@ -226,6 +226,8 @@ class Dropout(HybridBlock):
 --
 rate : float
 Fraction of the input units to drop. Must be a number between 0 and 1.
+axes : tuple of int, default ()
+The axes on which dropout mask is shared. If empty, regular dropout is 
applied.
 
 
 Inputs:
@@ -239,15 +241,16 @@ class Dropout(HybridBlock):
 `Dropout: A Simple Way to Prevent Neural Networks from Overfitting
 `_
 """
-def __init__(self, rate, **kwargs):
+def __init__(self, rate, axes=(), **kwargs):
 super(Dropout, self).__init__(**kwargs)
 self._rate = rate
+self._axes = axes
 
 def hybrid_forward(self, F, x):
-return F.Dropout(x, p=self._rate, name='fwd')
+return F.Dropout(x, p=self._rate, axes=self._axes, name='fwd')
 
 def __repr__(self):
-s = '{name}(p = {_rate})'
+s = '{name}(p = {_rate}, axes={_axes})'
 return s.format(name=self.__class__.__name__,
 **self.__dict__)
 
diff --git a/python/mxnet/gluon/rnn/rnn_cell.py 
b/python/mxnet/gluon/rnn/rnn_cell.py
index 61bf24e..f5c72f5 100644
--- a/python/mxnet/gluon/rnn/rnn_cell.py
+++ b/python/mxnet/gluon/rnn/rnn_cell.py
@@ -713,6 +713,8 @@ class DropoutCell(HybridRecurrentCell):
 rate : float
 Percentage of elements to drop out, which
 is 1 - percentage to retain.
+axes : tuple of int, default ()
+The axes on which dropout mask is shared. If empty, regular dropout is 
applied.
 
 
 Inputs:
@@ -723,13 +725,14 @@ class DropoutCell(HybridRecurrentCell):
 - **out**: output tensor with shape `(batch_size, size)`.
 - **next_states**: returns input `states` directly.
 """
-def __init__(self, rate, prefix=None, params=None):
+def __init__(self, rate, axes=(), prefix=None, params=None):
 super(DropoutCell, self).__init__(prefix, params)
 assert isinstance(rate, numeric_types), "rate must be a number"
-self.rate = rate
+self._rate = rate
+self._axes = axes
 
 def __repr__(self):
-s = '{name}(rate = {rate})'
+s = '{name}(rate={_rate}, axes={_axes})'
 return s.format(name=self.__class__.__name__,
 

[GitHub] sxjscience commented on a change in pull request #10032: add axes support for dropouts in gluon

2018-03-08 Thread GitBox
sxjscience commented on a change in pull request #10032: add axes support for 
dropouts in gluon
URL: https://github.com/apache/incubator-mxnet/pull/10032#discussion_r173283167
 
 

 ##
 File path: tests/python/unittest/test_gluon.py
 ##
 @@ -827,6 +827,46 @@ def selu(x):
 x = point_to_validate.reshape((1, 3, 2))
 assert_almost_equal(prelu(x).asnumpy(), mx.nd.where(x >= 0, x, 0.25 * 
x).asnumpy())
 
+@with_seed()
+def test_dropout():
+def get_slice(x, axis, idx):
+ix = ()
+for i in range(x.ndim):
+if i == axis:
+ix += (idx,)
+else:
+ix += (slice(None, None, None),)
+return x[ix]
+
+def check_dropout_axes(ratio, shape, axes):
+compactshape = list(shape)
+for axis in axes:
+compactshape[axis] = 1
+compactx = mx.random.uniform(shape=tuple(compactshape))
+broadcastx = compactx.broadcast_to(shape)
+dropouty = mx.gluon.nn.Dropout(rate=ratio, axes=axes)(broadcastx)
 
 Review comment:
   May need consider to improve the test in the future. Currently there's no 
guarantee that the observed dropout ratio matches the given dropout ratio.


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   >