[GitHub] eric-haibin-lin commented on a change in pull request #9625: sparse regression operators

2018-03-01 Thread GitBox
eric-haibin-lin commented on a change in pull request #9625: sparse regression 
operators
URL: https://github.com/apache/incubator-mxnet/pull/9625#discussion_r171780581
 
 

 ##
 File path: tests/python/unittest/test_operator.py
 ##
 @@ -219,40 +219,62 @@ def check_slice_channel(data_ndim, axis, num_outputs, 
squeeze_axis):
 check_slice_channel(data_ndim=5, axis=-2, num_outputs=3, squeeze_axis=True)
 
 
-def check_regression(symbol, forward, backward):
-data = mx.symbol.Variable('data')
-label = mx.symbol.Variable('label')
-out = symbol(data, label)
-shape = (3, 1)
-arr_data = mx.random.uniform(-1, 1, shape, 
ctx=mx.cpu()).copyto(default_context())
-arr_label = mx.random.uniform(0, 1, shape[0], 
ctx=mx.cpu()).copyto(default_context())
-arr_grad = mx.nd.empty(shape)
-exec1 = out.bind(default_context(),
- args=[arr_data, arr_label],
- args_grad={"data" : arr_grad})
-exec1.forward(is_train=True)
-out1 = exec1.outputs[0].asnumpy()
-npout = forward(arr_data.asnumpy())
-# Non-zero atol required by test_operator_gpu.py:test_regression with seed 
651640549
-atol = 1e-5
-assert_almost_equal(npout, out1, atol=atol)
-
-exec1.backward()
-npout = backward(npout,  arr_label.asnumpy().reshape(npout.shape))
-assert_almost_equal(npout, arr_grad.asnumpy(), atol=atol)
-
-
 @with_seed()
 def test_regression():
+''' test regression operator '''
+def check_regression(symbol, forward, backward, shape, stype='default', 
densities=[0, 0.5, 1]):
+# init executor
+data = mx.symbol.Variable('data')
+label = mx.symbol.Variable('label', stype=stype)
+out = symbol(data, label)
+grad_req = {'data': 'write', 'label': 'null'}
+out_exec = out.simple_bind(default_context(), grad_req=grad_req,
+data=shape, label=shape)
+arg_map = dict(zip(out.list_arguments(), out_exec.arg_arrays))
+grad_map = dict(zip(out.list_arguments(), out_exec.grad_arrays))
+# init data
+arr_data = mx.random.uniform(-1, 1, shape)
+arg_map["data"][:] = arr_data
+# init label based on density
+arr_label = arg_map["label"]
+atol = 1e-5
+for density in densities:
+arr_label[:] = rand_ndarray(shape, stype, density=density)
+out_exec.forward(is_train=True)
+out_exec.backward()
+np_out = forward(arr_data.asnumpy())
+out_grad = backward(np_out, 
arr_label.asnumpy().reshape(np_out.shape))
+assert_almost_equal(out_exec.outputs[0].asnumpy(), np_out, 
atol=atol)
+assert_almost_equal(grad_map["data"].asnumpy(), out_grad, 
atol=atol)
+
+shape = (50, 1)
 
 Review comment:
   consider better test case.. shape=(50,1) is not a good candidate for CSR


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] qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369845861
 
 
   @sxjscience 
   
   OK, I can download VS 2015 and give it a try!  Can anyone in the team give 
some instructions on building mxnet using MinGW/MinGW-w64/cygwin??


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 #9957: R Package Fails to Build since #9882

2018-03-01 Thread GitBox
jeremiedb commented on issue #9957: R Package Fails to Build since #9882
URL: 
https://github.com/apache/incubator-mxnet/issues/9957#issuecomment-369833285
 
 
   DiagrammeR (package dependency used for graph visualisation) has just 
released 1.0 version in which a function is no longer supported. I can open a 
PR to have this fixed. 


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] qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369845861
 
 
   @sxjscience 
   
   OK, I can download VS 2015 and give it a try!  Can anyone in the team give 
some instructions on building mxnet using MinGW/MinGW-w64/cygwin2??


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


With regards,
Apache Git Services


[GitHub] nihui opened a new pull request #9960: add label augmentation support in image recordio2

2018-03-01 Thread GitBox
nihui opened a new pull request #9960: add label augmentation support in image 
recordio2
URL: https://github.com/apache/incubator-mxnet/pull/9960
 
 
   ## Description ##
   
   pass the label data to the augmenter implementation so that the label could 
be changed when image transformation applied during augmentation.
   It is useful for regression task such as landmark localization.
   
   ## Checklist ##
   ### Essentials ###
   - [ ] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] 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] SamaelChen closed issue #9956: Runtime errors during multiple outputs training under Ubuntu

2018-03-01 Thread GitBox
SamaelChen closed issue #9956: Runtime errors during multiple outputs training 
under Ubuntu
URL: https://github.com/apache/incubator-mxnet/issues/9956
 
 
   


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] SamaelChen commented on issue #9956: Runtime errors during multiple outputs training under Ubuntu

2018-03-01 Thread GitBox
SamaelChen commented on issue #9956: Runtime errors during multiple outputs 
training under Ubuntu
URL: 
https://github.com/apache/incubator-mxnet/issues/9956#issuecomment-369845109
 
 
   @sxjscience 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] fhieber commented on issue #9950: [OP] LayerNorm in MXNet

2018-03-01 Thread GitBox
fhieber commented on issue #9950: [OP] LayerNorm in MXNet
URL: 
https://github.com/apache/incubator-mxnet/issues/9950#issuecomment-369845023
 
 
   I think this would be a great addition (also see #6995).


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] qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369843962
 
 
   @sxjscience
   
   Actually I have tried build mxnet cpp package in various platforms, 
including linux, mac os and Windows, however it is really painful to build 
mxnet in Windows. Linux and mac works quite fine.
   
   Building mxnet cpp package using **VS 2017** got following error:
   
   ```
   9>"Running: python OpWrapperGenerator.py 
F:/tools/mxnet/vs_build/Debug/libmxnet.dll"
   10>-- ?: ??: mlp, ??: Debug x64 --
   11>-- ?: ??: alexnet, ??: Debug x64 --
   12>-- ?: ??: charRNN, ??: Debug x64 --
   13>-- ?: ??: googlenet, ??: Debug x64 --
   14>-- ?: ??: inception_bn, ??: Debug x64 --
   15>-- ?: ??: lenet, ??: Debug x64 --
   16>-- ?: ??: lenet_with_mxdataiter, ??: Debug x64 --
   17>-- ?: ??: mlp_cpu, ??: Debug x64 --
   10>mlp.cpp
   12>charRNN.cpp
   13>googlenet.cpp
   17>mlp_cpu.cpp
   14>inception_bn.cpp
   11>alexnet.cpp
   15>lenet.cpp
   13>LINK : fatal error LNK1104: ???mxnet_static.lib?
   17>LINK : fatal error LNK1104: ???mxnet_static.lib?
   14>LINK : fatal error LNK1104: ???mxnet_static.lib?
   10>LINK : fatal error LNK1104: ???mxnet_static.lib?
   13>googlenet.vcxproj - ???
   17>mlp_cpu.vcxproj - ???
   10>mlp.vcxproj - ???
   14>inception_bn.vcxproj - ???
   18>-- ?: ??: cpp_package_deploy_library, ??: Debug x64 --
   19>-- ?: ??: mlp_gpu, ??: Debug x64 --
   20>-- ?: ??: resnet, ??: Debug x64 --
   12>LINK : fatal error LNK1104: ???mxnet_static.lib?
   15>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.cpp
   12>charRNN.vcxproj - ???
   15>lenet.vcxproj - ???
   11>LINK : fatal error LNK1104: ???mxnet_static.lib?
   11>alexnet.vcxproj - ???
   19>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.vcxproj - ???
   21>-- ?: ??: INSTALL, ??: Debug x64 --
   21>?? 
   == ??: ?? 2  10  7  9 ? ==
   ```
   
   1. How to fix the windows build error??
   2. Can mxnet built using mingw??If so, would be tell me how to solve the 
mingw build problem???
   3. *If possible, I strongly suggest you add a tutorial on how to solve 
common build problems on different platforms!*
   
   Much 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] wkcn commented on a change in pull request #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on a change in pull request #9939: add multi proposal operator 
(cpu version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#discussion_r171778623
 
 

 ##
 File path: src/operator/contrib/multi_proposal.cc
 ##
 @@ -22,11 +22,253 @@
  * Licensed under The Apache-2.0 License [see LICENSE for details]
  * \file multi_proposal.cc
  * \brief
- * \author Xizhou Zhu
+ * \author Xizhou Zhu, Kan Wu
 */
 
 #include "./multi_proposal-inl.h"
 
+//
+// Bounding Box Transform Utils
+//
+namespace mxnet {
+namespace op {
+namespace utils {
+
+// bbox prediction and clip to the image borders
+inline void BBoxTransformInv(const mshadow::Tensor& boxes,
+ const mshadow::Tensor& deltas,
+ const float im_height,
+ const float im_width,
+ const int real_height,
+ const int real_width,
+ mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
+float width = boxes[index][2] - boxes[index][0] + 1.0;
+float height = boxes[index][3] - boxes[index][1] + 1.0;
+float ctr_x = boxes[index][0] + 0.5 * (width - 1.0);
+float ctr_y = boxes[index][1] + 0.5 * (height - 1.0);
+
+float dx = deltas[a*4 + 0][h][w];
+float dy = deltas[a*4 + 1][h][w];
+float dw = deltas[a*4 + 2][h][w];
+float dh = deltas[a*4 + 3][h][w];
+
+float pred_ctr_x = dx * width + ctr_x;
+float pred_ctr_y = dy * height + ctr_y;
+float pred_w = exp(dw) * width;
+float pred_h = exp(dh) * height;
+
+float pred_x1 = pred_ctr_x - 0.5 * (pred_w - 1.0);
+float pred_y1 = pred_ctr_y - 0.5 * (pred_h - 1.0);
+float pred_x2 = pred_ctr_x + 0.5 * (pred_w - 1.0);
+float pred_y2 = pred_ctr_y + 0.5 * (pred_h - 1.0);
+
+pred_x1 = std::max(std::min(pred_x1, im_width - 1.0f), 0.0f);
+pred_y1 = std::max(std::min(pred_y1, im_height - 1.0f), 0.0f);
+pred_x2 = std::max(std::min(pred_x2, im_width - 1.0f), 0.0f);
+pred_y2 = std::max(std::min(pred_y2, im_height - 1.0f), 0.0f);
+
+(*out_pred_boxes)[index][0] = pred_x1;
+(*out_pred_boxes)[index][1] = pred_y1;
+(*out_pred_boxes)[index][2] = pred_x2;
+(*out_pred_boxes)[index][3] = pred_y2;
+
+if (h >= real_height || w >= real_width) {
+  (*out_pred_boxes)[index][4] = -1.0;
+}
+  }
+}
+  }
+}
+
+// iou prediction and clip to the image border
+inline void IoUTransformInv(const mshadow::Tensor& boxes,
+const mshadow::Tensor& deltas,
+const float im_height,
+const float im_width,
+const int real_height,
+const int real_width,
+mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
 
 Review comment:
   @cjolivier01 I think we can merge the three for-loop to a for-loop, then use 
OMP to optimize it


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


With regards,
Apache Git Services


[GitHub] qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369843962
 
 
   @sxjscience
   
   Actually I have tried build mxnet cpp package in various platforms, 
including linux, mac os and Windows, however it is really painful to build 
mxnet in Windows. Linux and mac works quite fine.
   
   Building mxnet cpp package using **VS 2017** got following error:
   
   ```
   9>"Running: python OpWrapperGenerator.py 
F:/tools/mxnet/vs_build/Debug/libmxnet.dll"
   10>-- ?: ??: mlp, ??: Debug x64 --
   11>-- ?: ??: alexnet, ??: Debug x64 --
   12>-- ?: ??: charRNN, ??: Debug x64 --
   13>-- ?: ??: googlenet, ??: Debug x64 --
   14>-- ?: ??: inception_bn, ??: Debug x64 --
   15>-- ?: ??: lenet, ??: Debug x64 --
   16>-- ?: ??: lenet_with_mxdataiter, ??: Debug x64 --
   17>-- ?: ??: mlp_cpu, ??: Debug x64 --
   10>mlp.cpp
   12>charRNN.cpp
   13>googlenet.cpp
   17>mlp_cpu.cpp
   14>inception_bn.cpp
   11>alexnet.cpp
   15>lenet.cpp
   13>LINK : fatal error LNK1104: ???mxnet_static.lib?
   17>LINK : fatal error LNK1104: ???mxnet_static.lib?
   14>LINK : fatal error LNK1104: ???mxnet_static.lib?
   10>LINK : fatal error LNK1104: ???mxnet_static.lib?
   13>googlenet.vcxproj - ???
   17>mlp_cpu.vcxproj - ???
   10>mlp.vcxproj - ???
   14>inception_bn.vcxproj - ???
   18>-- ?: ??: cpp_package_deploy_library, ??: Debug x64 --
   19>-- ?: ??: mlp_gpu, ??: Debug x64 --
   20>-- ?: ??: resnet, ??: Debug x64 --
   12>LINK : fatal error LNK1104: ???mxnet_static.lib?
   15>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.cpp
   12>charRNN.vcxproj - ???
   15>lenet.vcxproj - ???
   11>LINK : fatal error LNK1104: ???mxnet_static.lib?
   11>alexnet.vcxproj - ???
   19>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.vcxproj - ???
   21>-- ?: ??: INSTALL, ??: Debug x64 --
   21>?? 
   == ??: ?? 2  10  7  9 ? ==
   ```
   
   1. How to fix the windows build error??
   2. Can mxnet built using mingw??If so, would be tell me how to solve the 
mingw build problem???
   
   Much 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] qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
qingyuanxingsi commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369843962
 
 
   Actually I have tried build mxnet cpp package in various platforms, 
including linux, mac os and Windows, however it is really painful to build 
mxnet in Windows. Linux and mac works quite fine.
   
   Building mxnet cpp package using VS 2017 got following error:
   
   ```
   9>"Running: python OpWrapperGenerator.py 
F:/tools/mxnet/vs_build/Debug/libmxnet.dll"
   10>-- ?: ??: mlp, ??: Debug x64 --
   11>-- ?: ??: alexnet, ??: Debug x64 --
   12>-- ?: ??: charRNN, ??: Debug x64 --
   13>-- ?: ??: googlenet, ??: Debug x64 --
   14>-- ?: ??: inception_bn, ??: Debug x64 --
   15>-- ?: ??: lenet, ??: Debug x64 --
   16>-- ?: ??: lenet_with_mxdataiter, ??: Debug x64 --
   17>-- ?: ??: mlp_cpu, ??: Debug x64 --
   10>mlp.cpp
   12>charRNN.cpp
   13>googlenet.cpp
   17>mlp_cpu.cpp
   14>inception_bn.cpp
   11>alexnet.cpp
   15>lenet.cpp
   13>LINK : fatal error LNK1104: ???mxnet_static.lib?
   17>LINK : fatal error LNK1104: ???mxnet_static.lib?
   14>LINK : fatal error LNK1104: ???mxnet_static.lib?
   10>LINK : fatal error LNK1104: ???mxnet_static.lib?
   13>googlenet.vcxproj - ???
   17>mlp_cpu.vcxproj - ???
   10>mlp.vcxproj - ???
   14>inception_bn.vcxproj - ???
   18>-- ?: ??: cpp_package_deploy_library, ??: Debug x64 --
   19>-- ?: ??: mlp_gpu, ??: Debug x64 --
   20>-- ?: ??: resnet, ??: Debug x64 --
   12>LINK : fatal error LNK1104: ???mxnet_static.lib?
   15>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.cpp
   12>charRNN.vcxproj - ???
   15>lenet.vcxproj - ???
   11>LINK : fatal error LNK1104: ???mxnet_static.lib?
   11>alexnet.vcxproj - ???
   19>LINK : fatal error LNK1104: ???mxnet_static.lib?
   19>mlp_gpu.vcxproj - ???
   21>-- ?: ??: INSTALL, ??: Debug x64 --
   21>?? 
   == ??: ?? 2  10  7  9 ? ==
   ```
   
   1. How to fix the windows build error??
   2. Can mxnet built using mingw??If so, would be tell me how to solve the 
mingw build problem???
   
   Much 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] pengzhao-intel commented on issue #9916: precision bug in batchnorm.

2018-03-01 Thread GitBox
pengzhao-intel commented on issue #9916: precision bug in batchnorm.
URL: 
https://github.com/apache/incubator-mxnet/issues/9916#issuecomment-369839293
 
 
   @zheng-da could you try w/o MKL-DNN backend?


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 #9959: Revise the profiler examples and documents

2018-03-01 Thread GitBox
pengzhao-intel commented on issue #9959: Revise the profiler examples and 
documents
URL: 
https://github.com/apache/incubator-mxnet/issues/9959#issuecomment-369838905
 
 
   @sxjscience I will file a PR to update the latest CPU performance later.


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


With regards,
Apache Git Services


[GitHub] jeremiedb commented on issue #9957: R Package Fails to Build since #9882

2018-03-01 Thread GitBox
jeremiedb commented on issue #9957: R Package Fails to Build since #9882
URL: 
https://github.com/apache/incubator-mxnet/issues/9957#issuecomment-369833285
 
 
   DiagrammeR (package dependency used for graph visualisation) has just 
released 1.0 version in which a function is longer supported. I can open a PR 
to have this fixed. 


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-01 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_r171770268
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -113,15 +121,19 @@ inline void ROIPoolForward(const Tensor 
,
   }
 }
   }
-  // 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);
+  // Decrement all data pointers
+  batch_data -= c * data.size(2) * data.size(3);
 
 Review comment:
   same here but subtract


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-01 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_r171770338
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -74,7 +76,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
+  batch_data += c * data.size(2) * data.size(3);
 
 Review comment:
   multiply*


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-01 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_r171770240
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -74,7 +76,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
+  batch_data += c * data.size(2) * data.size(3);
 
 Review comment:
   if you do that, you can just keep adding that number each pass of c and then 
you don?t need to do a multiple for these at all


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-01 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_r171770132
 
 

 ##
 File path: src/operator/roi_pooling.cc
 ##
 @@ -74,7 +76,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
+  batch_data += c * data.size(2) * data.size(3);
 
 Review comment:
   please cache the xx.size(2) * you.size(3) result outside of the loops since 
they are invariant, so as to perform fewer multiplies.


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


With regards,
Apache Git Services


[GitHub] xinyu-intel commented on issue #9918: Update mkldnn to the newest & Add clang build test with mkldnn.

2018-03-01 Thread GitBox
xinyu-intel commented on issue #9918: Update mkldnn to the newest & Add clang 
build test with mkldnn.
URL: https://github.com/apache/incubator-mxnet/pull/9918#issuecomment-369828691
 
 
   @marcoabreu I come across the unit test error again(this time is R pkg 
building). Could you help me 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] sxjscience opened a new issue #9959: Revise the profiler examples and documents

2018-03-01 Thread GitBox
sxjscience opened a new issue #9959: Revise the profiler examples and documents
URL: https://github.com/apache/incubator-mxnet/issues/9959
 
 
   ## Description
   
   The new profiler API uses new arguments and functions and breaks the 
examples in 
https://github.com/apache/incubator-mxnet/tree/master/example/profiler. Also 
the documents in https://mxnet.incubator.apache.org/faq/perf.html need to be 
updated 


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


With regards,
Apache Git Services


[GitHub] xinyu-intel opened a new pull request #9958: Parallelization for ROIpooling OP

2018-03-01 Thread GitBox
xinyu-intel opened a new pull request #9958: Parallelization for ROIpooling OP
URL: https://github.com/apache/incubator-mxnet/pull/9958
 
 
   ## Description ##
   
   **What's the problem?**
   
   ROIpooling is used in the Faster-RCNN. It will consume lots of time in the 
inference path because of the current implementation 
[(here)](https://github.com/apache/incubator-mxnet/blob/master/src/operator/roi_pooling.cc
   ) is not parallelized. 
   
   One profiling results as below:
   
   Time   of each OP: | ms | ms/call | calls
   -- | -- | -- | --
   ROIPooling | **38718.288** | 1548.73152 | 25
   Convolution | 9963.628 | 3.724720748 | 2675
   Reshape | 0.677 | 0.00677 | 100
   Activation | 1089.6 | 0.427294118 | 2550
   SoftmaxActivation | 43.279 | 1.73116 | 25
   add_n | 1664.403 | 2.017458182 | 825
   Pooling | 68.531 | 1.37062 | 50
   _contrib_Proposal | 351.051 | 14.04204 | 25
   softmax | 0.658 | 0.02632 | 25
   FullyConnected | 29.328 | 0.58656 | 50
   BatchNorm | 2865.261 | 1.123631765 | 2550
   
   
   
   
   **What we have tried**
   
   We @pengzhao-intel @TaoLv have parallelized this pooling algorithm and got 
the 20+X performance improvement by OpenMP directives.
   
   
![Faster-RCNN](https://user-images.githubusercontent.com/22461308/36769144-6c456376-1c7d-11e8-8968-faf5043287a6.png)
   
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [x] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [x] Parallelization for ROIpooling
   


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] wentingj commented on issue #9552: [REQUEST FOR REVIEW | DO NOT MERGE] Model Quantization with Calibration

2018-03-01 Thread GitBox
wentingj commented on issue #9552: [REQUEST FOR REVIEW | DO NOT MERGE] Model 
Quantization with Calibration
URL: https://github.com/apache/incubator-mxnet/pull/9552#issuecomment-369827420
 
 
   @reminisce we have tested conv benchmark on MKLDNN, can be a reference for 
you. Thank you.
   [conv benchmark for int8 on 
MKLDNN.pptx](https://github.com/apache/incubator-mxnet/files/1773845/conv.benchmark.for.int8.on.MKLDNN.pptx)
   


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 #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
cjolivier01 commented on a change in pull request #9939: add multi proposal 
operator (cpu version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#discussion_r171767280
 
 

 ##
 File path: src/operator/contrib/multi_proposal.cc
 ##
 @@ -22,11 +22,253 @@
  * Licensed under The Apache-2.0 License [see LICENSE for details]
  * \file multi_proposal.cc
  * \brief
- * \author Xizhou Zhu
+ * \author Xizhou Zhu, Kan Wu
 */
 
 #include "./multi_proposal-inl.h"
 
+//
+// Bounding Box Transform Utils
+//
+namespace mxnet {
+namespace op {
+namespace utils {
+
+// bbox prediction and clip to the image borders
+inline void BBoxTransformInv(const mshadow::Tensor& boxes,
+ const mshadow::Tensor& deltas,
+ const float im_height,
+ const float im_width,
+ const int real_height,
+ const int real_width,
+ mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
+float width = boxes[index][2] - boxes[index][0] + 1.0;
+float height = boxes[index][3] - boxes[index][1] + 1.0;
+float ctr_x = boxes[index][0] + 0.5 * (width - 1.0);
+float ctr_y = boxes[index][1] + 0.5 * (height - 1.0);
+
+float dx = deltas[a*4 + 0][h][w];
+float dy = deltas[a*4 + 1][h][w];
+float dw = deltas[a*4 + 2][h][w];
+float dh = deltas[a*4 + 3][h][w];
+
+float pred_ctr_x = dx * width + ctr_x;
+float pred_ctr_y = dy * height + ctr_y;
+float pred_w = exp(dw) * width;
+float pred_h = exp(dh) * height;
+
+float pred_x1 = pred_ctr_x - 0.5 * (pred_w - 1.0);
+float pred_y1 = pred_ctr_y - 0.5 * (pred_h - 1.0);
+float pred_x2 = pred_ctr_x + 0.5 * (pred_w - 1.0);
+float pred_y2 = pred_ctr_y + 0.5 * (pred_h - 1.0);
+
+pred_x1 = std::max(std::min(pred_x1, im_width - 1.0f), 0.0f);
+pred_y1 = std::max(std::min(pred_y1, im_height - 1.0f), 0.0f);
+pred_x2 = std::max(std::min(pred_x2, im_width - 1.0f), 0.0f);
+pred_y2 = std::max(std::min(pred_y2, im_height - 1.0f), 0.0f);
+
+(*out_pred_boxes)[index][0] = pred_x1;
+(*out_pred_boxes)[index][1] = pred_y1;
+(*out_pred_boxes)[index][2] = pred_x2;
+(*out_pred_boxes)[index][3] = pred_y2;
+
+if (h >= real_height || w >= real_width) {
+  (*out_pred_boxes)[index][4] = -1.0;
+}
+  }
+}
+  }
+}
+
+// iou prediction and clip to the image border
+inline void IoUTransformInv(const mshadow::Tensor& boxes,
+const mshadow::Tensor& deltas,
+const float im_height,
+const float im_width,
+const int real_height,
+const int real_width,
+mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
 
 Review comment:
   which one do you think should be parallelized? always the outside one? the 
one with the largest number of iterations? the smallest number of iterations? 
what?s the convention on this (i?ve been curious of this myself)


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET

2018-03-01 Thread GitBox
cjolivier01 commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET
URL: https://github.com/apache/incubator-mxnet/pull/9940#issuecomment-369824157
 
 
   why can it be removed?


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-01 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_r171762604
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -798,11 +776,16 @@ inline void DotCsrRspDnsImpl(const OpContext& ctx,
   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;
+for (dim_t ind = 0; ind < nnr; ind++) {
+  row_idx_map.emplace(row_idx_ptr[ind], ind);
+}
 mxnet_op::Kernel::Launch(s, 
num_threads,
 
 Review comment:
   No need to parallelize by `RowBlocks`. 1 thread per row is fine and 
potentially leads to better workload balance


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 opened a new issue #9957: R Package Fails to Build since #9882

2018-03-01 Thread GitBox
eric-haibin-lin opened a new issue #9957: R Package Fails to Build since #9882
URL: https://github.com/apache/incubator-mxnet/issues/9957
 
 
   Master build broken since #9882 - although the PR didn't touch anything 
related to R. 
   
   
http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/master/438/pipeline/462
   
   
http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/master/439/pipeline
   
   @marcoabreu are you aware of any related changes on CI? 


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: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on issue #9939: 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-369813766
 
 
   @pengzhao-intel Thank you! I will have a try.


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 #9956: Runtime errors during multiple outputs training under Ubuntu

2018-03-01 Thread GitBox
sxjscience commented on issue #9956: Runtime errors during multiple outputs 
training under Ubuntu
URL: 
https://github.com/apache/incubator-mxnet/issues/9956#issuecomment-369813682
 
 
   @SamaelChen I've answered the question here 
https://discuss.gluon.ai/t/topic/4941/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] pengzhao-intel commented on a change in pull request #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
pengzhao-intel commented on a change in pull request #9939: add multi proposal 
operator (cpu version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#discussion_r171758785
 
 

 ##
 File path: src/operator/contrib/multi_proposal.cc
 ##
 @@ -22,11 +22,253 @@
  * Licensed under The Apache-2.0 License [see LICENSE for details]
  * \file multi_proposal.cc
  * \brief
- * \author Xizhou Zhu
+ * \author Xizhou Zhu, Kan Wu
 */
 
 #include "./multi_proposal-inl.h"
 
+//
+// Bounding Box Transform Utils
+//
+namespace mxnet {
+namespace op {
+namespace utils {
+
+// bbox prediction and clip to the image borders
+inline void BBoxTransformInv(const mshadow::Tensor& boxes,
+ const mshadow::Tensor& deltas,
+ const float im_height,
+ const float im_width,
+ const int real_height,
+ const int real_width,
+ mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
 
 Review comment:
   Is it possible to parallel the for-loop by OMP?


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 #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
pengzhao-intel commented on a change in pull request #9939: add multi proposal 
operator (cpu version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#discussion_r171758821
 
 

 ##
 File path: src/operator/contrib/multi_proposal.cc
 ##
 @@ -22,11 +22,253 @@
  * Licensed under The Apache-2.0 License [see LICENSE for details]
  * \file multi_proposal.cc
  * \brief
- * \author Xizhou Zhu
+ * \author Xizhou Zhu, Kan Wu
 */
 
 #include "./multi_proposal-inl.h"
 
+//
+// Bounding Box Transform Utils
+//
+namespace mxnet {
+namespace op {
+namespace utils {
+
+// bbox prediction and clip to the image borders
+inline void BBoxTransformInv(const mshadow::Tensor& boxes,
+ const mshadow::Tensor& deltas,
+ const float im_height,
+ const float im_width,
+ const int real_height,
+ const int real_width,
+ mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
+float width = boxes[index][2] - boxes[index][0] + 1.0;
+float height = boxes[index][3] - boxes[index][1] + 1.0;
+float ctr_x = boxes[index][0] + 0.5 * (width - 1.0);
+float ctr_y = boxes[index][1] + 0.5 * (height - 1.0);
+
+float dx = deltas[a*4 + 0][h][w];
+float dy = deltas[a*4 + 1][h][w];
+float dw = deltas[a*4 + 2][h][w];
+float dh = deltas[a*4 + 3][h][w];
+
+float pred_ctr_x = dx * width + ctr_x;
+float pred_ctr_y = dy * height + ctr_y;
+float pred_w = exp(dw) * width;
+float pred_h = exp(dh) * height;
+
+float pred_x1 = pred_ctr_x - 0.5 * (pred_w - 1.0);
+float pred_y1 = pred_ctr_y - 0.5 * (pred_h - 1.0);
+float pred_x2 = pred_ctr_x + 0.5 * (pred_w - 1.0);
+float pred_y2 = pred_ctr_y + 0.5 * (pred_h - 1.0);
+
+pred_x1 = std::max(std::min(pred_x1, im_width - 1.0f), 0.0f);
+pred_y1 = std::max(std::min(pred_y1, im_height - 1.0f), 0.0f);
+pred_x2 = std::max(std::min(pred_x2, im_width - 1.0f), 0.0f);
+pred_y2 = std::max(std::min(pred_y2, im_height - 1.0f), 0.0f);
+
+(*out_pred_boxes)[index][0] = pred_x1;
+(*out_pred_boxes)[index][1] = pred_y1;
+(*out_pred_boxes)[index][2] = pred_x2;
+(*out_pred_boxes)[index][3] = pred_y2;
+
+if (h >= real_height || w >= real_width) {
+  (*out_pred_boxes)[index][4] = -1.0;
+}
+  }
+}
+  }
+}
+
+// iou prediction and clip to the image border
+inline void IoUTransformInv(const mshadow::Tensor& boxes,
+const mshadow::Tensor& deltas,
+const float im_height,
+const float im_width,
+const int real_height,
+const int real_width,
+mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
+float x1 = boxes[index][0];
+float y1 = boxes[index][1];
+float x2 = boxes[index][2];
+float y2 = boxes[index][3];
+
+float dx1 = deltas[a * 4 + 0][h][w];
+float dy1 = deltas[a * 4 + 1][h][w];
+float dx2 = deltas[a * 4 + 2][h][w];
+float dy2 = deltas[a * 4 + 3][h][w];
+
+float pred_x1 = x1 + dx1;
+float pred_y1 = y1 + dy1;
+float pred_x2 = x2 + dx2;
+float pred_y2 = y2 + dy2;
+
+pred_x1 = std::max(std::min(pred_x1, im_width - 1.0f), 0.0f);
+pred_y1 = std::max(std::min(pred_y1, im_height - 1.0f), 0.0f);
+pred_x2 = std::max(std::min(pred_x2, im_width - 1.0f), 0.0f);
+pred_y2 = std::max(std::min(pred_y2, im_height - 1.0f), 0.0f);
+
+(*out_pred_boxes)[index][0] = pred_x1;
+(*out_pred_boxes)[index][1] = pred_y1;
+(*out_pred_boxes)[index][2] = pred_x2;
+(*out_pred_boxes)[index][3] = pred_y2;
+
+if (h >= real_height || w >= real_width) {
+  (*out_pred_boxes)[index][4] = -1.0f;
+}
+  }
+}
+  }
+}
+
+// filter box by set confidence to zero
+// * height or width < rpn_min_size

[GitHub] pengzhao-intel commented on a change in pull request #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
pengzhao-intel commented on a change in pull request #9939: add multi proposal 
operator (cpu version) and fix the bug in proposal op (gpu version)
URL: https://github.com/apache/incubator-mxnet/pull/9939#discussion_r171758760
 
 

 ##
 File path: src/operator/contrib/multi_proposal.cc
 ##
 @@ -22,11 +22,253 @@
  * Licensed under The Apache-2.0 License [see LICENSE for details]
  * \file multi_proposal.cc
  * \brief
- * \author Xizhou Zhu
+ * \author Xizhou Zhu, Kan Wu
 */
 
 #include "./multi_proposal-inl.h"
 
+//
+// Bounding Box Transform Utils
+//
+namespace mxnet {
+namespace op {
+namespace utils {
+
+// bbox prediction and clip to the image borders
+inline void BBoxTransformInv(const mshadow::Tensor& boxes,
+ const mshadow::Tensor& deltas,
+ const float im_height,
+ const float im_width,
+ const int real_height,
+ const int real_width,
+ mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
+float width = boxes[index][2] - boxes[index][0] + 1.0;
+float height = boxes[index][3] - boxes[index][1] + 1.0;
+float ctr_x = boxes[index][0] + 0.5 * (width - 1.0);
+float ctr_y = boxes[index][1] + 0.5 * (height - 1.0);
+
+float dx = deltas[a*4 + 0][h][w];
+float dy = deltas[a*4 + 1][h][w];
+float dw = deltas[a*4 + 2][h][w];
+float dh = deltas[a*4 + 3][h][w];
+
+float pred_ctr_x = dx * width + ctr_x;
+float pred_ctr_y = dy * height + ctr_y;
+float pred_w = exp(dw) * width;
+float pred_h = exp(dh) * height;
+
+float pred_x1 = pred_ctr_x - 0.5 * (pred_w - 1.0);
+float pred_y1 = pred_ctr_y - 0.5 * (pred_h - 1.0);
+float pred_x2 = pred_ctr_x + 0.5 * (pred_w - 1.0);
+float pred_y2 = pred_ctr_y + 0.5 * (pred_h - 1.0);
+
+pred_x1 = std::max(std::min(pred_x1, im_width - 1.0f), 0.0f);
+pred_y1 = std::max(std::min(pred_y1, im_height - 1.0f), 0.0f);
+pred_x2 = std::max(std::min(pred_x2, im_width - 1.0f), 0.0f);
+pred_y2 = std::max(std::min(pred_y2, im_height - 1.0f), 0.0f);
+
+(*out_pred_boxes)[index][0] = pred_x1;
+(*out_pred_boxes)[index][1] = pred_y1;
+(*out_pred_boxes)[index][2] = pred_x2;
+(*out_pred_boxes)[index][3] = pred_y2;
+
+if (h >= real_height || w >= real_width) {
+  (*out_pred_boxes)[index][4] = -1.0;
+}
+  }
+}
+  }
+}
+
+// iou prediction and clip to the image border
+inline void IoUTransformInv(const mshadow::Tensor& boxes,
+const mshadow::Tensor& deltas,
+const float im_height,
+const float im_width,
+const int real_height,
+const int real_width,
+mshadow::Tensor *out_pred_boxes) {
+  CHECK_GE(boxes.size(1), 4);
+  CHECK_GE(out_pred_boxes->size(1), 4);
+  int anchors = deltas.size(0) / 4;
+  int heights = deltas.size(1);
+  int widths = deltas.size(2);
+
+  for (int a = 0; a < anchors; ++a) {
+for (int h = 0; h < heights; ++h) {
+  for (int w = 0; w < widths; ++w) {
+index_t index = h * (widths * anchors) + w * (anchors) + a;
 
 Review comment:
   Is it possible to parallel the for-loop by OMP?


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] yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET

2018-03-01 Thread GitBox
yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET
URL: https://github.com/apache/incubator-mxnet/pull/9940#issuecomment-369809831
 
 
   yes,USE_OLDCMAKECUDA can removed.


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: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on issue #9939: 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-369797499
 
 
   I wrote a cpu/gpu consistency test for Proposal and MultiProposal.
   I found there is difference between the CPU output and the GPU output for 
mx.nd.contrib.Proposal.
   
   It seems that the index order of the Non-Maximum-Suppression result may be 
different between the CPU implementation and the GPU implementation.
   And another problem is that it may need to add the condition `num_to_keep < 
rpn_post_nms_top_n`
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cu#L341
   reference: 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cc#L235
   
   Here is the cpu/gpu consistency test.
   ```python
   import mxnet as mx
   import numpy as np
   
   # @with_seed()
   def test_multi_proposal_op():
   # paramters
   feature_stride = 16
   scales = (8, 16, 32)
   ratios = (0.5, 1, 2)
   rpn_pre_nms_top_n = 12000
   rpn_post_nms_top_n = 2000
   threshold = 0.7
   rpn_min_size = 16
   
   feat_len = 14
   H, W = feat_len, feat_len
   num_anchors = len(scales) * len(ratios)
   count_anchors = H * W * num_anchors
   
   def get_new_data(batch_size, ctx):
   '''
   cls_prob: (batch_size, 2 * num_anchors, H, W)
   bbox_pred: (batch_size, 4 * num_anchors, H, W)
   im_info: (batch_size, 3)
   '''
   
   cls_prob = mx.nd.empty((batch_size, 2 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   bbox_pred = mx.nd.empty((batch_size, 4 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   im_info = mx.nd.empty((batch_size, 3), dtype = np.float32, ctx = ctx)
   
   cls_prob = mx.nd.array(np.random.random(cls_prob.shape), ctx = ctx)
   bbox_pred = mx.nd.array(np.random.random(bbox_pred.shape), ctx = ctx)
   
   for i in range(batch_size):
   im_size = np.random.randint(100, feat_len * feature_stride, size 
= (2,))
   im_scale = np.random.randint(70, 100) / 100.0
   im_info[i, :] = [im_size[0], im_size[1], im_scale]
   return cls_prob, bbox_pred, im_info
   
   def check_proposal_consistency(op, batch_size):
   '''
   op is mx.nd.contrib.Proposal or mx.nd.contrib.MultiProposal
   '''
   cls_prob, bbox_pred, im_info = get_new_data(batch_size, mx.cpu(0))
   rois_cpu, score_cpu = op(
   cls_score = cls_prob,
   bbox_pred = bbox_pred,
   im_info = im_info,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   gpu_ctx = mx.gpu(0)
   
   # copy data to gpu from cpu
   cls_prob_gpu = cls_prob.as_in_context(gpu_ctx)
   bbox_pred_gpu = bbox_pred.as_in_context(gpu_ctx)
   im_info_gpu = im_info.as_in_context(gpu_ctx)
   
   rois_gpu, score_gpu = op(
   cls_score = cls_prob_gpu,
   bbox_pred = bbox_pred_gpu,
   im_info = im_info_gpu,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   print (rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(score_cpu.asnumpy(), score_gpu.asnumpy())
   
   check_proposal_consistency(mx.nd.contrib.Proposal, 1)
   check_proposal_consistency(mx.nd.contrib.MultiProposal, 20)
   
   test_multi_proposal_op()
   print ("test 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] wkcn commented on issue #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on issue #9939: 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-369797499
 
 
   I wrote a cpu/gpu consistency test for Proposal and MultiProposal.
   I found there is difference between the CPU output and the GPU output for 
mx.nd.contrib.Proposal.
   
   It seems that the index order of the Non-Maximum-Suppression result may be 
different.
   And another problem is that it may need to add the condition `num_to_keep < 
rpn_post_nms_top_n`
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cu#L341
   reference: 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cc#L235
   
   Here is the cpu/gpu consistency test.
   ```python
   import mxnet as mx
   import numpy as np
   
   # @with_seed()
   def test_multi_proposal_op():
   # paramters
   feature_stride = 16
   scales = (8, 16, 32)
   ratios = (0.5, 1, 2)
   rpn_pre_nms_top_n = 12000
   rpn_post_nms_top_n = 2000
   threshold = 0.7
   rpn_min_size = 16
   
   feat_len = 14
   H, W = feat_len, feat_len
   num_anchors = len(scales) * len(ratios)
   count_anchors = H * W * num_anchors
   
   def get_new_data(batch_size, ctx):
   '''
   cls_prob: (batch_size, 2 * num_anchors, H, W)
   bbox_pred: (batch_size, 4 * num_anchors, H, W)
   im_info: (batch_size, 3)
   '''
   
   cls_prob = mx.nd.empty((batch_size, 2 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   bbox_pred = mx.nd.empty((batch_size, 4 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   im_info = mx.nd.empty((batch_size, 3), dtype = np.float32, ctx = ctx)
   
   cls_prob = mx.nd.array(np.random.random(cls_prob.shape), ctx = ctx)
   bbox_pred = mx.nd.array(np.random.random(bbox_pred.shape), ctx = ctx)
   
   for i in range(batch_size):
   im_size = np.random.randint(100, feat_len * feature_stride, size 
= (2,))
   im_scale = np.random.randint(70, 100) / 100.0
   im_info[i, :] = [im_size[0], im_size[1], im_scale]
   return cls_prob, bbox_pred, im_info
   
   def check_proposal_consistency(op, batch_size):
   '''
   op is mx.nd.contrib.Proposal or mx.nd.contrib.MultiProposal
   '''
   cls_prob, bbox_pred, im_info = get_new_data(batch_size, mx.cpu(0))
   rois_cpu, score_cpu = op(
   cls_score = cls_prob,
   bbox_pred = bbox_pred,
   im_info = im_info,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   gpu_ctx = mx.gpu(0)
   
   # copy data to gpu from cpu
   cls_prob_gpu = cls_prob.as_in_context(gpu_ctx)
   bbox_pred_gpu = bbox_pred.as_in_context(gpu_ctx)
   im_info_gpu = im_info.as_in_context(gpu_ctx)
   
   rois_gpu, score_gpu = op(
   cls_score = cls_prob_gpu,
   bbox_pred = bbox_pred_gpu,
   im_info = im_info_gpu,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   print (rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(score_cpu.asnumpy(), score_gpu.asnumpy())
   
   check_proposal_consistency(mx.nd.contrib.Proposal, 1)
   check_proposal_consistency(mx.nd.contrib.MultiProposal, 20)
   
   test_multi_proposal_op()
   print ("test 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] wkcn commented on issue #9939: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on issue #9939: 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-369797499
 
 
   I wrote a cpu/gpu consistency test for Proposal and MultiProposal.
   I found there is difference between the CPU output and the GPU output for 
mx.nd.contrib.Proposal.
   
   It seems that the index order of Nonmaximum may be different.
   And another problem is that it may need to add the condition `num_to_keep < 
rpn_post_nms_top_n`
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cu#L341
   reference: 
https://github.com/apache/incubator-mxnet/blob/master/src/operator/contrib/proposal.cc#L235
   
   Here is the cpu/gpu consistency test.
   ```python
   import mxnet as mx
   import numpy as np
   
   # @with_seed()
   def test_multi_proposal_op():
   # paramters
   feature_stride = 16
   scales = (8, 16, 32)
   ratios = (0.5, 1, 2)
   rpn_pre_nms_top_n = 12000
   rpn_post_nms_top_n = 2000
   threshold = 0.7
   rpn_min_size = 16
   
   feat_len = 14
   H, W = feat_len, feat_len
   num_anchors = len(scales) * len(ratios)
   count_anchors = H * W * num_anchors
   
   def get_new_data(batch_size, ctx):
   '''
   cls_prob: (batch_size, 2 * num_anchors, H, W)
   bbox_pred: (batch_size, 4 * num_anchors, H, W)
   im_info: (batch_size, 3)
   '''
   
   cls_prob = mx.nd.empty((batch_size, 2 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   bbox_pred = mx.nd.empty((batch_size, 4 * num_anchors, H, W), dtype = 
np.float32, ctx = ctx)
   im_info = mx.nd.empty((batch_size, 3), dtype = np.float32, ctx = ctx)
   
   cls_prob = mx.nd.array(np.random.random(cls_prob.shape), ctx = ctx)
   bbox_pred = mx.nd.array(np.random.random(bbox_pred.shape), ctx = ctx)
   
   for i in range(batch_size):
   im_size = np.random.randint(100, feat_len * feature_stride, size 
= (2,))
   im_scale = np.random.randint(70, 100) / 100.0
   im_info[i, :] = [im_size[0], im_size[1], im_scale]
   return cls_prob, bbox_pred, im_info
   
   def check_proposal_consistency(op, batch_size):
   '''
   op is mx.nd.contrib.Proposal or mx.nd.contrib.MultiProposal
   '''
   cls_prob, bbox_pred, im_info = get_new_data(batch_size, mx.cpu(0))
   rois_cpu, score_cpu = op(
   cls_score = cls_prob,
   bbox_pred = bbox_pred,
   im_info = im_info,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   gpu_ctx = mx.gpu(0)
   
   # copy data to gpu from cpu
   cls_prob_gpu = cls_prob.as_in_context(gpu_ctx)
   bbox_pred_gpu = bbox_pred.as_in_context(gpu_ctx)
   im_info_gpu = im_info.as_in_context(gpu_ctx)
   
   rois_gpu, score_gpu = op(
   cls_score = cls_prob_gpu,
   bbox_pred = bbox_pred_gpu,
   im_info = im_info_gpu,
   feature_stride = feature_stride,
   scales = scales,
   ratios = ratios,
   rpn_pre_nms_top_n = rpn_pre_nms_top_n,
   rpn_post_nms_top_n = rpn_post_nms_top_n,
   threshold = threshold,
   rpn_min_size = rpn_min_size, output_score = True)
   
   print (rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(rois_cpu.asnumpy(), rois_gpu.asnumpy())
   assert np.allclose(score_cpu.asnumpy(), score_gpu.asnumpy())
   
   check_proposal_consistency(mx.nd.contrib.Proposal, 1)
   check_proposal_consistency(mx.nd.contrib.MultiProposal, 20)
   
   test_multi_proposal_op()
   print ("test 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] SamaelChen opened a new issue #9956: Runtime errors during multiple outputs training under Ubuntu

2018-03-01 Thread GitBox
SamaelChen opened a new issue #9956: Runtime errors during multiple outputs 
training under Ubuntu
URL: https://github.com/apache/incubator-mxnet/issues/9956
 
 
   ## Description
   Build a multiple output network but cannot train under Ubuntu. Refer 
https://discuss.mxnet.io/t/runtime-errors-during-multi-label-learning-using-ubuntu-but-not-mac/264
   
   ## 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/samael/anaconda3/lib/python3.6/site-packages/pip
   --MXNet Info---
   Version  : 1.1.0
   Directory: /home/samael/anaconda3/lib/python3.6/site-packages/mxnet
   Commit Hash   : 07a83a0325a3d782513a04f47d711710972cb144
   --System Info--
   Platform : Linux-4.4.0-116-generic-x86_64-with-debian-stretch-sid
   system   : Linux
   node : samael-U3000
   release  : 4.4.0-116-generic
   version  : #140-Ubuntu SMP Mon Feb 12 21:23:04 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):4
   On-line CPU(s) list:   0-3
   Thread(s) per core:2
   Core(s) per socket:2
   Socket(s): 1
   NUMA node(s):  1
   Vendor ID: GenuineIntel
   CPU family:6
   Model: 78
   Model name:Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz
   Stepping:  3
   CPU MHz:   2797.234
   CPU max MHz:   3100.
   CPU min MHz:   400.
   BogoMIPS:  5183.85
   Virtualization:VT-x
   L1d cache: 32K
   L1i cache: 32K
   L2 cache:  256K
   L3 cache:  4096K
   NUMA node0 CPU(s): 0-3
   Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx 
pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl 
xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl 
vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe 
popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch 
epb invpcid_single intel_pt retpoline kaiser tpr_shadow vnmi flexpriority ept 
vpid fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap 
clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify 
hwp_act_window hwp_epp
   --Network Test--
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0020 
sec, LOAD: 1.8534 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0313 sec, LOAD: 
0.3726 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0296 sec, LOAD: 
1.8140 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
 DNS: 0.0407 sec, LOAD: 2.1261 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0301 sec, LOAD: 
0.4480 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0217 sec, 
LOAD: 0.2630 sec.
   
   
   Package used (Python/R/Scala/Julia):
   (I'm using Python)
   
   ## Error Message:
in ()
18 l = nd.slice_axis(y, axis=1, begin=i, end=i+1)
19 loss = loss_func(o, l)
   ---> 20 loss.backward()
21 trainer.step(x.shape[0])
22 
   
   ~/anaconda3/lib/python3.6/site-packages/mxnet/ndarray/ndarray.py in 
backward(self, out_grad, retain_graph, train_mode)
  2000 ctypes.c_int(train_mode),
  2001 ctypes.c_void_p(0),
   -> 2002 ctypes.c_void_p(0)))
  2003 
  2004 def tostype(self, stype):
   
   ~/anaconda3/lib/python3.6/site-packages/mxnet/base.py in check_call(ret)
   144 """
   145 if ret != 0:
   --> 146 raise MXNetError(py_str(_LIB.MXGetLastError()))
   147 
   148 
   
   MXNetError: [09:53:55] 
/home/travis/build/dmlc/mxnet-distro/mxnet-build/dmlc-core/include/dmlc/./any.h:286:
 Check failed: type_ != nullptr The any container is empty 
requested=N5mxnet10Imperative6AGInfoE
   
   Stack trace returned 10 entries:
   [bt] (0) 
/home/samael/anaconda3/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x192112) 
[0x7f28d0e07112]
   [bt] (1) 
/home/samael/anaconda3/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x192738) 
[0x7f28d0e07738]
   [bt] (2) 
/home/samael/anaconda3/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x237700c)
 [0x7f28d2fec00c]
   [bt] (3) 

[GitHub] John-Boik commented on issue #9838: fail with parameters of size 1, tuple issue

2018-03-01 Thread GitBox
John-Boik commented on issue #9838: fail with parameters of size 1, tuple issue
URL: 
https://github.com/apache/incubator-mxnet/issues/9838#issuecomment-369794538
 
 
   I created a small application to replicate one of the problems. In the code 
below, the error occurs due to the print statement as noted.
   ```
   import mxnet as mx
   from mxnet import nd, gluon
   from mxnet.gluon import Block
   
   class myBlock(Block):
   
   def __init__(self, **kwargs):
   super(myBlock, self).__init__(**kwargs)
   
   with self.name_scope():
   self.p1 = self.params.get('param1', init= mx.init.Constant(1), 
shape=(1), grad_req = 'write') 
   self.p2 = self.params.get('param2', init= mx.init.Constant(1), 
shape=(2,3), grad_req = 'write') 
   
   class App(object):
   def __init__(self):
   net = gluon.nn.Sequential()
   
   self.p3 = net.params.get('param3', init= mx.init.Constant(1), 
shape=(1), grad_req = 'write') 
   with net.name_scope():
   net.add(myBlock()) 
   
   net.collect_params().initialize(ctx=mx.gpu())
   params = net.collect_params()
   
   print(params)  # the error occurs due to this print statement
   
   net.save_params('test_params')
   net.load_params('test_params', ctx=mx.gpu())
   print("\ndone\n")
   
   app = App()  
   ```  
   The error is:
   
   ```
 File "/usr/local/lib/python3.5/dist-packages/mxnet/gluon/parameter.py", 
line 127, in __repr__
   return s.format(**self.__dict__)
   KeyError: 'shape'
   ```
   
   This is one of the errors that I saw with my real code. It occurs near line 
127 in parameters.py. A fix is pasted below. 
   
   ```
   def __repr__(self):
   s = 'Parameter {name} (shape={shape}, dtype={dtype})'
   s2 = 'Parameter {name} (shape={_shape}, dtype={dtype})'  # added 
this line
   return s2.format(**self.__dict__)  # changed s.format() to 
s2.format()
   ```
   
   I am not seeing the additional errors with this short app that I saw with my 
real code, the errors due to self._shape not being a tuple. To take care of 
these errors, I altered parameters.py in the three locations mentioned.  In all 
three locations, I added this:
   ```
   if isinstance(self._shape, tuple)==False:
   self._shape = (self._shape,)
   ```
   


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 #9918: Update mkldnn to the newest & Add clang build test with mkldnn.

2018-03-01 Thread GitBox
TaoLv commented on a change in pull request #9918: Update mkldnn to the newest 
& Add clang build test with mkldnn.
URL: https://github.com/apache/incubator-mxnet/pull/9918#discussion_r171748002
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_base.cc
 ##
 @@ -237,13 +237,14 @@ mkldnn_memory_format_t 
GetDefaultFormat(mkldnn::memory::desc desc) {
   case mkldnn_gOIhw16o16i:
   case mkldnn_gIOhw16o16i:
   case mkldnn_gOihw8o:
+  case mkldnn_Goihw8g:
   case mkldnn_gOihw16o:
   case mkldnn_gOhwi8o:
   case mkldnn_gOhwi16o:
   case mkldnn_gOhIw16o4i:
 return mkldnn_goihw;
   default:
-LOG(FATAL) << "Unknown MKLDNN format for 4 dimensions: " << 
desc.data.format;
+LOG(FATAL) << "Unknown MKLDNN format for 5 dimensions: " << 
desc.data.format;
 
 Review comment:
   Data format is an attribute of mkldnn memory which has been hidden into 
NDArray. So I don't think the default statement could be touched from a python 
test case currently. Actually, all mkldnn data formats are covered by the list 
here now. We provided the default statement just for improving the robustness 
of the code. But there is still a risk that mkldnn may add other format into 
its own [data format 
list](https://github.com/intel/mkl-dnn/blob/master/include/mkldnn_types.h#L107) 
in the future and that will run into this default statement then.
   If we should set a CPP test case for it, could you kindly point out where I 
can find the examples for this kind of test cases. 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] cjolivier01 commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET

2018-03-01 Thread GitBox
cjolivier01 commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET
URL: https://github.com/apache/incubator-mxnet/pull/9940#issuecomment-369793427
 
 
   it looks like USE_OLDCMAKECUDA is removed?


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] yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET

2018-03-01 Thread GitBox
yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET
URL: https://github.com/apache/incubator-mxnet/pull/9940#issuecomment-369791923
 
 
   @cjolivier01 If want to choose a CUDA version, you need to set it with 
-T.like` cuda=8.0`.
   if not set,cmake will automatically select the latest version.
   And host=x64 is recommended.


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] yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET

2018-03-01 Thread GitBox
yajiedesign commented on issue #9940: remove set CMAKE_GENERATOR_TOOLSET
URL: https://github.com/apache/incubator-mxnet/pull/9940#issuecomment-369791923
 
 
   @cjolivier01 If want to choose a CUDA version, you need to set it with 
-T.like` cuda=8.0`.
   if not set,cmake will automatically select the latest version.
   


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


With regards,
Apache Git Services


[GitHub] anirudh2290 commented on issue #9951: Fix test_cast

2018-03-01 Thread GitBox
anirudh2290 commented on issue #9951: Fix test_cast
URL: https://github.com/apache/incubator-mxnet/pull/9951#issuecomment-369776121
 
 
   @marcoabreu did you happen to see this failure with test_random before on 
windows. I saw this twice today.


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

2018-03-01 Thread GitBox
saswatac commented on issue #9921: [DISCUSSION] module.contrib.SparseModule API
URL: 
https://github.com/apache/incubator-mxnet/issues/9921#issuecomment-369774948
 
 
   Looks good. Why not add this in module itself instead of contrib?


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: add multi proposal operator (cpu version) and fix the bug in proposal op (gpu version)

2018-03-01 Thread GitBox
wkcn commented on issue #9939: 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-369773050
 
 
   @piiswrong Yes, I will add it.


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


With regards,
Apache Git Services


[GitHub] sxjscience commented on a change in pull request #9934: [Gluon] Support variable sequence length in gluon.RecurrentCell

2018-03-01 Thread GitBox
sxjscience commented on a change in pull request #9934: [Gluon] Support 
variable sequence length in gluon.RecurrentCell 
URL: https://github.com/apache/incubator-mxnet/pull/9934#discussion_r171729757
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_cell.py
 ##
 @@ -83,15 +83,28 @@ def _format_sequence(length, inputs, layout, merge, 
in_layout=None):
 F = ndarray
 batch_size = inputs[0].shape[batch_axis]
 if merge is True:
-inputs = [F.expand_dims(i, axis=axis) for i in inputs]
-inputs = F.concat(*inputs, dim=axis)
+inputs = F.stack(*inputs, axis=axis)
 in_axis = axis
 
 if isinstance(inputs, tensor_types) and axis != in_axis:
 inputs = F.swapaxes(inputs, dim1=axis, dim2=in_axis)
 
 return inputs, axis, F, batch_size
 
+def _mask_sequence_variable_length(F, data, length, valid_length, time_axis, 
merge):
+assert valid_length is not None
+if isinstance(data, tensor_types):
+outputs = F.SequenceMask(data, sequence_length=valid_length, 
use_sequence_length=True,
+ axis=time_axis)
+else:
+outputs = F.SequenceMask(F.stack(*data, axis=time_axis),
+ sequence_length=valid_length,
+ use_sequence_length=True,
+ axis=time_axis)
+if not merge:
+outputs = _as_list(F.split(outputs, num_outputs=length, axis=time_axis,
+   squeeze_axis=True))
 
 Review comment:
   I've changed the code to use one line only.


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


With regards,
Apache Git Services


[GitHub] sxjscience commented on a change in pull request #9934: [Gluon] Support variable sequence length in gluon.RecurrentCell

2018-03-01 Thread GitBox
sxjscience commented on a change in pull request #9934: [Gluon] Support 
variable sequence length in gluon.RecurrentCell 
URL: https://github.com/apache/incubator-mxnet/pull/9934#discussion_r171729757
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_cell.py
 ##
 @@ -83,15 +83,28 @@ def _format_sequence(length, inputs, layout, merge, 
in_layout=None):
 F = ndarray
 batch_size = inputs[0].shape[batch_axis]
 if merge is True:
-inputs = [F.expand_dims(i, axis=axis) for i in inputs]
-inputs = F.concat(*inputs, dim=axis)
+inputs = F.stack(*inputs, axis=axis)
 in_axis = axis
 
 if isinstance(inputs, tensor_types) and axis != in_axis:
 inputs = F.swapaxes(inputs, dim1=axis, dim2=in_axis)
 
 return inputs, axis, F, batch_size
 
+def _mask_sequence_variable_length(F, data, length, valid_length, time_axis, 
merge):
+assert valid_length is not None
+if isinstance(data, tensor_types):
+outputs = F.SequenceMask(data, sequence_length=valid_length, 
use_sequence_length=True,
+ axis=time_axis)
+else:
+outputs = F.SequenceMask(F.stack(*data, axis=time_axis),
+ sequence_length=valid_length,
+ use_sequence_length=True,
+ axis=time_axis)
+if not merge:
+outputs = _as_list(F.split(outputs, num_outputs=length, axis=time_axis,
+   squeeze_axis=True))
 
 Review comment:
   I've changed the code to use one line only. @szha 


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 opened a new pull request #9955: [DO NOT MERGE] Cython CI check

2018-03-01 Thread GitBox
cjolivier01 opened a new pull request #9955: [DO NOT MERGE] Cython CI check
URL: https://github.com/apache/incubator-mxnet/pull/9955
 
 
   ## Description ##
   
   This is an early WIP, so this PR will most likely get closed and recreated 
several times
   
   ## Checklist ##
   ### Essentials ###
   - [ ] Passed code style checking (`make lint`)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - [ ] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Interesting edge cases to note here
   


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


With regards,
Apache Git Services


[GitHub] marcoabreu commented on a change in pull request #9946: [DO NOT MERGE] Start CI docker revamp

2018-03-01 Thread GitBox
marcoabreu commented on a change in pull request #9946: [DO NOT MERGE] Start CI 
docker revamp
URL: https://github.com/apache/incubator-mxnet/pull/9946#discussion_r171728648
 
 

 ##
 File path: tests/ci_build/Dockerfile.cpu_clang
 ##
 @@ -1,21 +0,0 @@
-FROM ubuntu:16.04
-
-COPY install/ubuntu_install_core.sh /install/
 
 Review comment:
   I agree. I'll check if I might be able to reduce the number of Dockerfiles 
and thus make centralization obsolete.


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


With regards,
Apache Git Services


[GitHub] sxjscience commented on issue #9952: Latest Windows pre-built binary for R?(MXNet Version 1.1.0)

2018-03-01 Thread GitBox
sxjscience commented on issue #9952: Latest Windows pre-built binary for 
R?(MXNet Version 1.1.0)
URL: 
https://github.com/apache/incubator-mxnet/issues/9952#issuecomment-369767659
 
 
   @hetong007 


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 a change in pull request #9953: add clarifications for environment variables

2018-03-01 Thread GitBox
rahul003 commented on a change in pull request #9953: add clarifications for 
environment variables
URL: https://github.com/apache/incubator-mxnet/pull/9953#discussion_r171726325
 
 

 ##
 File path: docs/faq/env_var.md
 ##
 @@ -110,9 +114,12 @@ When USE_PROFILER is enabled in Makefile or CMake, the 
following environments ca
 ## Other Environment Variables
 
 * MXNET_CUDNN_AUTOTUNE_DEFAULT
-  - Values: 0(false) or 1(true) ```(default=1)```
-  - The default value of cudnn auto tunning for convolution layers.
+  - Values: 0, 1, or 2 ```(default=1)```
+  - The default value of cudnn auto tuning for convolution layers.
   - Auto tuning is turned off by default. For benchmarking, set this to 1 to 
turn it on by default.
 
 Review comment:
   Weird. Corrected, 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] rahul003 commented on a change in pull request #9953: add clarifications for environment variables

2018-03-01 Thread GitBox
rahul003 commented on a change in pull request #9953: add clarifications for 
environment variables
URL: https://github.com/apache/incubator-mxnet/pull/9953#discussion_r171726325
 
 

 ##
 File path: docs/faq/env_var.md
 ##
 @@ -110,9 +114,12 @@ When USE_PROFILER is enabled in Makefile or CMake, the 
following environments ca
 ## Other Environment Variables
 
 * MXNET_CUDNN_AUTOTUNE_DEFAULT
-  - Values: 0(false) or 1(true) ```(default=1)```
-  - The default value of cudnn auto tunning for convolution layers.
+  - Values: 0, 1, or 2 ```(default=1)```
+  - The default value of cudnn auto tuning for convolution layers.
   - Auto tuning is turned off by default. For benchmarking, set this to 1 to 
turn it on by default.
 
 Review comment:
   Weird. Corrected


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] tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI docker revamp

2018-03-01 Thread GitBox
tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI 
docker revamp
URL: https://github.com/apache/incubator-mxnet/pull/9946#discussion_r171724560
 
 

 ##
 File path: tests/ci_build/Dockerfile.cpu_clang
 ##
 @@ -1,21 +0,0 @@
-FROM ubuntu:16.04
-
-COPY install/ubuntu_install_core.sh /install/
 
 Review comment:
   is there any reason of why we don't want to separate the build scripts? It 
seems to me only a matter of taste and common docker's build would advocate the 
other way


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] lanking520 opened a new pull request #9954: Update on OSX_setup.md

2018-03-01 Thread GitBox
lanking520 opened a new pull request #9954: Update on OSX_setup.md
URL: https://github.com/apache/incubator-mxnet/pull/9954
 
 
   ## Description ##
   Modification on the setup guide for OSX users
   
   ## Checklist ##
   ### Essentials ###
   - [X] Passed code style checking (`make lint`)
   - [X] Changes are complete (i.e. I finished coding on this PR)
   - [X] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [X] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - [X] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ### Changes ###
   Add several changes in the setup document in OSX setup.
   Add note for issues in jupyter installation.
   Add maven installation as a scala installation requirement.
   
   ## Comments ##
   N/A
   


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 opened a new pull request #9953: add clarifications for environment variables

2018-03-01 Thread GitBox
rahul003 opened a new pull request #9953: add clarifications for environment 
variables
URL: https://github.com/apache/incubator-mxnet/pull/9953
 
 
   ## Description ##
   Doc changes
   
   ## 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 ###
   - MXNET_KVSTORE_REDUCTION_NTHREADS
   - MXNET_CUDNN_AUTOTUNE_DEFAULT
   


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] FrankLongueira opened a new issue #9952: Latest Windows pre-built binary?(MXNet Version 1.1.0)

2018-03-01 Thread GitBox
FrankLongueira opened a new issue #9952: Latest Windows pre-built binary?(MXNet 
Version 1.1.0)
URL: https://github.com/apache/incubator-mxnet/issues/9952
 
 
   Will the Windows pre-built binary be updated to the latest version soon? If 
not, where can I find the best instructions for building from source?


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


With regards,
Apache Git Services


[GitHub] anirudh2290 commented on issue #9951: Fix test_cast

2018-03-01 Thread GitBox
anirudh2290 commented on issue #9951: Fix test_cast
URL: https://github.com/apache/incubator-mxnet/pull/9951#issuecomment-369761869
 
 
   @piiswrong 


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


With regards,
Apache Git Services


[GitHub] anirudh2290 opened a new pull request #9951: Fix test_cast

2018-03-01 Thread GitBox
anirudh2290 opened a new pull request #9951: Fix test_cast
URL: https://github.com/apache/incubator-mxnet/pull/9951
 
 
   ## Description ##
   assert_almost_equal doesn't pass atol and thus results in using default atol 
of 1e-20. This results in intermittent failures as shown here: 
http://jenkins.mxnet-ci.amazon-ml.com/blue/organizations/jenkins/incubator-mxnet/detail/PR-9869/10/pipeline/466
   
   Tested with the failing seed: 1754533767
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [x] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - [x] To the my best knowledge, examples are either not affected by this 
change, or have been fixed to be compatible with this change
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Interesting edge cases to note here
   


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


With regards,
Apache Git Services


[GitHub] marcoabreu commented on a change in pull request #9946: [DO NOT MERGE] Start CI docker revamp

2018-03-01 Thread GitBox
marcoabreu commented on a change in pull request #9946: [DO NOT MERGE] Start CI 
docker revamp
URL: https://github.com/apache/incubator-mxnet/pull/9946#discussion_r171719266
 
 

 ##
 File path: tests/ci_build/Dockerfile.cpu_clang
 ##
 @@ -1,21 +0,0 @@
-FROM ubuntu:16.04
-
-COPY install/ubuntu_install_core.sh /install/
 
 Review comment:
   We plan to make use of a centralized docker repository for all our slaves as 
part of Auto Scaling, thus reducing the impact. But you're right, a single 
change will trigger rebuilds for all containers.


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] tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI docker revamp

2018-03-01 Thread GitBox
tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI 
docker revamp
URL: https://github.com/apache/incubator-mxnet/pull/9946#discussion_r171718429
 
 

 ##
 File path: tests/ci_build/Dockerfile.cpu_clang
 ##
 @@ -1,21 +0,0 @@
-FROM ubuntu:16.04
-
-COPY install/ubuntu_install_core.sh /install/
 
 Review comment:
   The problem of putting installation bash into in a centralized location, is 
that change of a single bash will trigger rebuild of entire docker image. 
   
   Having separate bash script is actually preferred and makes it easier to 
tweak new installations by putting them in the end to take benefit of the 
cache, (i.e.) you only build from the point of the new installations


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] tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI docker revamp

2018-03-01 Thread GitBox
tqchen commented on a change in pull request #9946: [DO NOT MERGE] Start CI 
docker revamp
URL: https://github.com/apache/incubator-mxnet/pull/9946#discussion_r171718429
 
 

 ##
 File path: tests/ci_build/Dockerfile.cpu_clang
 ##
 @@ -1,21 +0,0 @@
-FROM ubuntu:16.04
-
-COPY install/ubuntu_install_core.sh /install/
 
 Review comment:
   The problem of putting installation bash into in a centralized location, is 
that change of a single bash will trigger rebuild of entire docker image. 
   
   Having separate bash script is actually preferred and makes it easier to 
tweak new installations by putting them in the end to take benefit of the cache


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 #9944: MXNet MinGW-w64 build error

2018-03-01 Thread GitBox
sxjscience commented on issue #9944: MXNet MinGW-w64 build error
URL: 
https://github.com/apache/incubator-mxnet/issues/9944#issuecomment-369757178
 
 
   I think you can try to use Visual Studio instead. In fact, compiling by 
"Visual Studio" could be very simple after you get familiar with the tool. You 
can try to follow the [Windows Installation 
Guide](http://mxnet.incubator.apache.org/install/windows_setup.html). It uses 
VS2015 + CMake. 


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 issue #9892: [WIP] Serde Module for Import/Export of models between Onnx and Mxnet

2018-03-01 Thread GitBox
anirudhacharya commented on issue #9892: [WIP] Serde Module for Import/Export 
of models between Onnx and Mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9892#issuecomment-369754064
 
 
   will raise another PR. closing this PR


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 closed pull request #9892: [WIP] Serde Module for Import/Export of models between Onnx and Mxnet

2018-03-01 Thread GitBox
anirudhacharya closed pull request #9892: [WIP] Serde Module for Import/Export 
of models between Onnx and Mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9892
 
 
   

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/CMakeLists.txt b/CMakeLists.txt
index 16d365355ce..d229cb0847d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,6 +234,7 @@ include_directories("include")
 include_directories("mshadow")
 include_directories("3rdparty/cub")
 include_directories("nnvm/include")
+include_directories("nnvm/tvm/include")
 include_directories("dmlc-core/include")
 include_directories("dlpack/include")
 
@@ -696,4 +697,3 @@ endif()
 set(LINT_DIRS "include src plugin cpp-package tests")
 set(EXCLUDE_PATH "src/operator/contrib/ctc_include")
 add_custom_target(mxnet_lint COMMAND ${CMAKE_COMMAND} -DMSVC=${MSVC} 
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DLINT_DIRS=${LINT_DIRS} 
-DPROJECT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DPROJECT_NAME=mxnet 
-DEXCLUDE_PATH=${EXCLUDE_PATH} -P 
${CMAKE_CURRENT_SOURCE_DIR}/dmlc-core/cmake/lint.cmake)
-
diff --git a/Jenkinsfile b/Jenkinsfile
index c23bbbfe5a5..78af1cf021d 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -38,12 +38,12 @@ def init_git() {
   deleteDir()
   retry(5) {
 try {
-  // Make sure wait long enough for api.github.com request quota. 
Important: Don't increase the amount of 
+  // Make sure wait long enough for api.github.com request quota. 
Important: Don't increase the amount of
   // retries as this will increase the amount of requests and worsen the 
throttling
   timeout(time: 15, unit: 'MINUTES') {
 checkout scm
-sh 'git submodule update --init'
-sh 'git clean -d -f'
+sh 'git submodule update --init --recursive'
+sh 'git clean -d -f'
   }
 } catch (exc) {
   deleteDir()
@@ -61,8 +61,8 @@ def init_git_win() {
   // retries as this will increase the amount of requests and worsen the 
throttling
   timeout(time: 15, unit: 'MINUTES') {
 checkout scm
-bat 'git submodule update --init'
-bat 'git clean -d -f'
+bat 'git submodule update --init --recursive'
+bat 'git clean -d -f'
   }
 } catch (exc) {
   deleteDir()
@@ -332,6 +332,7 @@ try {
   make('build_cuda', flag)
   pack_lib('gpu')
   stash includes: 'build/cpp-package/example/test_score', name: 
'cpp_test_score'
+  stash includes: 'build/cpp-package/example/test_optimizer', name: 
'cpp_test_optimizer'
 }
   }
 },
@@ -676,6 +677,7 @@ try {
   init_git()
   unpack_lib('gpu')
   unstash 'cpp_test_score'
+  unstash 'cpp_test_optimizer'
   timeout(time: max_time, unit: 'MINUTES') {
 sh "${docker_run} gpu --dockerbinary nvidia-docker 
cpp-package/tests/ci_test.sh"
   }
diff --git a/Makefile b/Makefile
index cb3e63ba13b..5d81c7fbb16 100644
--- a/Makefile
+++ b/Makefile
@@ -91,7 +91,7 @@ ifeq ($(DEBUG), 1)
 else
CFLAGS += -O3 -DNDEBUG=1
 endif
-CFLAGS += -I$(ROOTDIR)/mshadow/ -I$(ROOTDIR)/dmlc-core/include -fPIC 
-I$(NNVM_PATH)/include -I$(DLPACK_PATH)/include -Iinclude $(MSHADOW_CFLAGS)
+CFLAGS += -I$(ROOTDIR)/mshadow/ -I$(ROOTDIR)/dmlc-core/include -fPIC 
-I$(NNVM_PATH)/include -I$(DLPACK_PATH)/include -I$(NNVM_PATH)/tvm/include 
-Iinclude $(MSHADOW_CFLAGS)
 LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
 ifeq ($(DEBUG), 1)
NVCCFLAGS += -std=c++11 -Xcompiler -D_FORCE_INLINES -g -G -O0 -ccbin 
$(CXX) $(MSHADOW_NVCCFLAGS)
@@ -356,7 +356,7 @@ ifeq ($(USE_CUDA), 1)
LDFLAGS += -lcuda -lnvrtc
CFLAGS += -DMXNET_ENABLE_CUDA_RTC=1
endif
-   # Make sure to add stubs as fallback in order to be able to build 
+   # Make sure to add stubs as fallback in order to be able to build
# without full CUDA install (especially if run without nvidia-docker)
LDFLAGS += -L/usr/local/cuda/lib64/stubs
SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu
diff --git a/cpp-package/example/test_optimizer.cpp 
b/cpp-package/example/test_optimizer.cpp
new file mode 100644
index 000..bf465b78698
--- /dev/null
+++ b/cpp-package/example/test_optimizer.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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
+ *
+ * 

[GitHub] sxjscience opened a new issue #9950: [OP] LayerNorm in MXNet

2018-03-01 Thread GitBox
sxjscience opened a new issue #9950: [OP] LayerNorm in MXNet
URL: https://github.com/apache/incubator-mxnet/issues/9950
 
 
   ## Description
   
   [Layer Normalization](https://arxiv.org/pdf/1607.06450.pdf) is becoming more 
and more common in deep learning models, especially RNNs. We need to support 
the layer normalization layer. Although we can implement it by combining the 
existing symbols, e.g, [Implementation in 
Sockeye](https://github.com/awslabs/sockeye/blob/master/sockeye/layers.py#L53-L112),
 the speed and memory cost would be large due to the various broadcasting 
operators that cannot be calculated inplace. Thus, we need to write our own C++ 
implementation of this operator.
   
   Some reference implementations:
   1. https://github.com/pytorch/pytorch/issues/1959
   2. https://github.com/MycChiu/fast-LayerNorm-TF


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 #9932: Fixing couple of bugs in profiler

2018-03-01 Thread GitBox
cjolivier01 commented on a change in pull request #9932: Fixing couple of bugs 
in profiler
URL: https://github.com/apache/incubator-mxnet/pull/9932#discussion_r171709894
 
 

 ##
 File path: src/profiler/profiler.h
 ##
 @@ -131,8 +131,9 @@ struct ProfileStat {
   size_t process_id_ = current_process_id();
 
   /*! \brief id of thread which operation run on */
-  std::thread::id thread_id_ = std::this_thread::get_id();  // Not yet seen a
-// case where this 
isn't valid
+  size_t thread_id_ = std::hash{}(std::this_thread::get_id());
 
 Review comment:
   only once


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 #9932: Fixing couple of bugs in profiler

2018-03-01 Thread GitBox
cjolivier01 commented on a change in pull request #9932: Fixing couple of bugs 
in profiler
URL: https://github.com/apache/incubator-mxnet/pull/9932#discussion_r171710020
 
 

 ##
 File path: src/profiler/profiler.h
 ##
 @@ -131,8 +131,9 @@ struct ProfileStat {
   size_t process_id_ = current_process_id();
 
   /*! \brief id of thread which operation run on */
-  std::thread::id thread_id_ = std::this_thread::get_id();  // Not yet seen a
-// case where this 
isn't valid
+  size_t thread_id_ = std::hash{}(std::this_thread::get_id());
 
 Review comment:
   it's no longer thread_id_ if you do this...


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 opened a new issue #9949: Mac build from source script validation fails

2018-03-01 Thread GitBox
aaronmarkham opened a new issue #9949: Mac build from source script validation 
fails
URL: https://github.com/apache/incubator-mxnet/issues/9949
 
 
   ## Description
   The installation instructions for Mac, refer you to this script:
   
https://raw.githubusercontent.com/dmlc/mxnet/master/setup-utils/install-mxnet-osx-python.sh
   
   If "fails" at the end during a test.
   
   ## Environment info (Required)
   
   macOS 10.12.6 (Sierra)
   
   MXNet commit hash:
   I chose to use the v1.1.0 tag for the install, so this is:
   07a83a0325a3d782513a04f47d711710972cb144
   
   ## Error Message:
   ```
   Finished processing dependencies for mxnet==1.1.0
   END: Install MXNet package for Python
   

   BEGIN: Test MXNet
   1,2c1,2
   < [[2. 2. 2.]
   <  [2. 2. 2.]]
   ---
   > [[ 2.  2.  2.]
   >  [ 2.  2.  2.]]

   ERROR: Following files differ: mxnet_test.log mxnet_test.expected
   ERROR: MXNet test failed
   END: Test MXNet

   :-(
   ```
   
   ## Steps to reproduce
   
   1. Set env var: `export MXNET_TAG=1.1.0`
   2. Run script: 
`https://raw.githubusercontent.com/dmlc/mxnet/master/setup-utils/install-mxnet-osx-python.sh`


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 #9934: [Gluon] Support variable sequence length in gluon.RecurrentCell

2018-03-01 Thread GitBox
szha commented on a change in pull request #9934: [Gluon] Support variable 
sequence length in gluon.RecurrentCell 
URL: https://github.com/apache/incubator-mxnet/pull/9934#discussion_r171707307
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_cell.py
 ##
 @@ -83,15 +83,28 @@ def _format_sequence(length, inputs, layout, merge, 
in_layout=None):
 F = ndarray
 batch_size = inputs[0].shape[batch_axis]
 if merge is True:
-inputs = [F.expand_dims(i, axis=axis) for i in inputs]
-inputs = F.concat(*inputs, dim=axis)
+inputs = F.stack(*inputs, axis=axis)
 in_axis = axis
 
 if isinstance(inputs, tensor_types) and axis != in_axis:
 inputs = F.swapaxes(inputs, dim1=axis, dim2=in_axis)
 
 return inputs, axis, F, batch_size
 
+def _mask_sequence_variable_length(F, data, length, valid_length, time_axis, 
merge):
+assert valid_length is not None
+if isinstance(data, tensor_types):
+outputs = F.SequenceMask(data, sequence_length=valid_length, 
use_sequence_length=True,
+ axis=time_axis)
+else:
+outputs = F.SequenceMask(F.stack(*data, axis=time_axis),
+ sequence_length=valid_length,
+ use_sequence_length=True,
+ axis=time_axis)
+if not merge:
+outputs = F.split(outputs, num_outputs=length, axis=time_axis, 
squeeze_axis=True)
+outputs = [outputs[i] for i in range(length)]
 
 Review comment:
   It's usually better to keep functions small. Since this function and 
format_sequence share the same merge and split logic, they should use the same 
code. If you think reusing the common part is not straightforward, consider 
refactoring the _format_sequence a bit.


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 #9824: Windows build instructions broken

2018-03-01 Thread GitBox
aaronmarkham commented on issue #9824: Windows build instructions broken
URL: 
https://github.com/apache/incubator-mxnet/issues/9824#issuecomment-369745192
 
 
   This has been fixed. @lebeg can you confirm and close if it works for you?


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 #9841: Update versions of python dependencies

2018-03-01 Thread GitBox
aaronmarkham commented on issue #9841: Update versions of python dependencies
URL: https://github.com/apache/incubator-mxnet/pull/9841#issuecomment-369744932
 
 
   @sandeep-krishnamurthy Our current build from source instructions for Mac 
tell you to use this script:
   
https://raw.githubusercontent.com/dmlc/mxnet/master/setup-utils/install-mxnet-osx-python.sh
   Will it get the benefit of this PR, or does the script need updating too?


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 #9943: [Don't MERGE] CI 2.0, revamp ci scripts and dockerfiles, integrate IoT builds

2018-03-01 Thread GitBox
marcoabreu closed pull request #9943: [Don't MERGE] CI 2.0, revamp ci scripts 
and dockerfiles, integrate IoT builds
URL: https://github.com/apache/incubator-mxnet/pull/9943
 
 
   

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/.mxnet_root b/.mxnet_root
new file mode 100644
index 000..e69de29bb2d
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d229cb0847d..ee4e8d6c70e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -102,6 +102,7 @@ else(MSVC)
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -g")
   elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
 add_definitions(-DNDEBUG=1)
+#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g -Werror")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -g")
   else()
 add_definitions(-DNDEBUG=1)
diff --git a/ci/README.md b/ci/README.md
new file mode 100644
index 000..98c74e31d87
--- /dev/null
+++ b/ci/README.md
@@ -0,0 +1,50 @@
+# Containerized build & test utilities
+
+This folder contains scripts and dockerfiles used to build and test MXNet 
using Docker containers
+
+You need docker and nvidia docker if you have a GPU.
+
+If you are in ubuntu an easy way to install Docker CE is executing the 
following script:
+
+
+```
+#!/bin/bash
+set -e
+set -x
+export DEBIAN_FRONTEND=noninteractive
+apt-get -y install curl
+curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
+add-apt-repository \
+   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
+  $(lsb_release -cs) \
+ stable"
+apt-get update
+apt-get -y install docker-ce
+service docker restart
+usermod -a -G docker $SUDO_USER
+```
+
+For detailed instructions go to the docker documentation.
+
+
+## build.py
+
+The main utility to build is build.py which will run docker and mount the 
mxnet folder as a volume
+to do in-place builds.
+
+The build.py script does two functions, build the docker image, and it can be 
also used to run
+commands inside this image with the propper mounts and paraphernalia required 
to build mxnet inside
+docker from the sources on the parent folder.
+
+A set of helper shell functions are in `functions.sh`. `build.py --help` will 
display usage
+information about the tool.
+
+To build for armv7 for example:
+
+```
+./build.py -p armv7 /work/functions.sh build_armv7
+```
+
+## Warning
+Due to current limitations of the CMake build system creating artifacts in the 
source 3rdparty
+folder of the parent mxnet sources concurrent builds of different platforms is 
NOT SUPPORTED.
diff --git a/ci/build.py b/ci/build.py
new file mode 100755
index 000..f9f1ba59c93
--- /dev/null
+++ b/ci/build.py
@@ -0,0 +1,181 @@
+#!/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 

[GitHub] marcoabreu commented on issue #9932: Fixing couple of bugs in profiler

2018-03-01 Thread GitBox
marcoabreu commented on issue #9932: Fixing couple of bugs in profiler
URL: https://github.com/apache/incubator-mxnet/pull/9932#issuecomment-369739888
 
 
   Yes it's flaky unfortunately. Please just push a new commit to trigger CI


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 #9918: Update mkldnn to the newest & Add clang build test with mkldnn.

2018-03-01 Thread GitBox
marcoabreu commented on issue #9918: Update mkldnn to the newest & Add clang 
build test with mkldnn.
URL: https://github.com/apache/incubator-mxnet/pull/9918#issuecomment-369739082
 
 
   It does not harm CI performance as it is not on the critical path. The 
builds are happening fairly quickly and we're considering adding ccache.
   
   Clang 3.9 and 5.0 are tested for Mac support. @KellenSunderland might 
provide some background here


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


With regards,
Apache Git Services


[GitHub] sxjscience commented on a change in pull request #9934: [Gluon] Support variable sequence length in gluon.RecurrentCell

2018-03-01 Thread GitBox
sxjscience commented on a change in pull request #9934: [Gluon] Support 
variable sequence length in gluon.RecurrentCell 
URL: https://github.com/apache/incubator-mxnet/pull/9934#discussion_r171700972
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_cell.py
 ##
 @@ -83,15 +83,28 @@ def _format_sequence(length, inputs, layout, merge, 
in_layout=None):
 F = ndarray
 batch_size = inputs[0].shape[batch_axis]
 if merge is True:
-inputs = [F.expand_dims(i, axis=axis) for i in inputs]
-inputs = F.concat(*inputs, dim=axis)
+inputs = F.stack(*inputs, axis=axis)
 in_axis = axis
 
 if isinstance(inputs, tensor_types) and axis != in_axis:
 inputs = F.swapaxes(inputs, dim1=axis, dim2=in_axis)
 
 return inputs, axis, F, batch_size
 
+def _mask_sequence_variable_length(F, data, length, valid_length, time_axis, 
merge):
+assert valid_length is not None
+if isinstance(data, tensor_types):
+outputs = F.SequenceMask(data, sequence_length=valid_length, 
use_sequence_length=True,
+ axis=time_axis)
+else:
+outputs = F.SequenceMask(F.stack(*data, axis=time_axis),
+ sequence_length=valid_length,
+ use_sequence_length=True,
+ axis=time_axis)
+if not merge:
+outputs = F.split(outputs, num_outputs=length, axis=time_axis, 
squeeze_axis=True)
+outputs = [outputs[i] for i in range(length)]
 
 Review comment:
   I find it not very good to reuse `_format_sequence` because there are 
additional clauses for determining the F in `_format_sequence`. Directly 
writing the splitting logic here should be more clear.


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 #9934: [Gluon] Support variable sequence length in gluon.RecurrentCell

2018-03-01 Thread GitBox
szha commented on a change in pull request #9934: [Gluon] Support variable 
sequence length in gluon.RecurrentCell 
URL: https://github.com/apache/incubator-mxnet/pull/9934#discussion_r171697866
 
 

 ##
 File path: python/mxnet/gluon/rnn/rnn_cell.py
 ##
 @@ -83,15 +83,28 @@ def _format_sequence(length, inputs, layout, merge, 
in_layout=None):
 F = ndarray
 batch_size = inputs[0].shape[batch_axis]
 if merge is True:
-inputs = [F.expand_dims(i, axis=axis) for i in inputs]
-inputs = F.concat(*inputs, dim=axis)
+inputs = F.stack(*inputs, axis=axis)
 in_axis = axis
 
 if isinstance(inputs, tensor_types) and axis != in_axis:
 inputs = F.swapaxes(inputs, dim1=axis, dim2=in_axis)
 
 return inputs, axis, F, batch_size
 
+def _mask_sequence_variable_length(F, data, length, valid_length, time_axis, 
merge):
+assert valid_length is not None
+if isinstance(data, tensor_types):
+outputs = F.SequenceMask(data, sequence_length=valid_length, 
use_sequence_length=True,
+ axis=time_axis)
+else:
+outputs = F.SequenceMask(F.stack(*data, axis=time_axis),
+ sequence_length=valid_length,
+ use_sequence_length=True,
+ axis=time_axis)
+if not merge:
+outputs = F.split(outputs, num_outputs=length, axis=time_axis, 
squeeze_axis=True)
+outputs = [outputs[i] for i in range(length)]
 
 Review comment:
   Use _format_sequence


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 #9892: [WIP] Serde Module for Import/Export of models between Onnx and Mxnet

2018-03-01 Thread GitBox
reminisce commented on a change in pull request #9892: [WIP] Serde Module for 
Import/Export of models between Onnx and Mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9892#discussion_r171673552
 
 

 ##
 File path: python/mxnet/contrib/serde/_export/__init__.py
 ##
 @@ -0,0 +1,4 @@
+import onnx
+
+def export_model(sym, params):
+pass
 
 Review comment:
   Is this the determined API for exporting MXNet models to onnx format? Have 
you considered whether we can borrow the interface of this function in Pytorch?
   https://github.com/pytorch/pytorch/blob/master/torch/onnx/__init__.py#L43


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 #9892: [WIP] Serde Module for Import/Export of models between Onnx and Mxnet

2018-03-01 Thread GitBox
reminisce commented on a change in pull request #9892: [WIP] Serde Module for 
Import/Export of models between Onnx and Mxnet
URL: https://github.com/apache/incubator-mxnet/pull/9892#discussion_r171671603
 
 

 ##
 File path: python/mxnet/contrib/serde/_import/__init__.py
 ##
 @@ -0,0 +1,26 @@
+# coding: utf-8
+"""import function"""
+import onnx
+from .import_onnx import GraphProto
+
+def import_model(model_file):
 
 Review comment:
   Is `import_model` a user level API? If so, why is it registered under a 
hidden module `_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] anirudh2290 commented on issue #9869: Exception handling documentation

2018-03-01 Thread GitBox
anirudh2290 commented on issue #9869: Exception handling documentation
URL: https://github.com/apache/incubator-mxnet/pull/9869#issuecomment-369706593
 
 
   @piiswrong Thanks! moved.


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] hetong007 commented on a change in pull request #9930: Support single array input for metric

2018-03-01 Thread GitBox
hetong007 commented on a change in pull request #9930: Support single array 
input for metric
URL: https://github.com/apache/incubator-mxnet/pull/9930#discussion_r171671073
 
 

 ##
 File path: python/mxnet/metric.py
 ##
 @@ -793,6 +793,8 @@ def update(self, labels, preds):
 
 if len(label.shape) == 1:
 label = label.reshape(label.shape[0], 1)
+if len(pred.shape) == 1:
+pred = pred.reshape(pred.shape[0], 1)
 
 
 Review comment:
   Why don't we check both length and shape? I assume they shoud always match.


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


With regards,
Apache Git Services


[GitHub] anirudh2290 commented on a change in pull request #9933: Adding support to profile kvstore server during distributed training

2018-03-01 Thread GitBox
anirudh2290 commented on a change in pull request #9933: Adding support to 
profile kvstore server during distributed training
URL: https://github.com/apache/incubator-mxnet/pull/9933#discussion_r171669210
 
 

 ##
 File path: src/kvstore/kvstore_dist_server.h
 ##
 @@ -153,23 +157,82 @@ class KVStoreDistServer {
 
   void CommandHandle(const ps::SimpleData& recved, ps::SimpleApp* app) {
 CommandType recved_type = static_cast(recved.head);
-if (recved_type == CommandType::kStopServer) {
-  exec_.Stop();
-} else if (recved_type == CommandType::kSyncMode) {
-  sync_mode_ = true;
-} else if (recved_type == CommandType::kSetGradientCompression) {
-  gradient_compression_->DecodeParams(recved.body);
-} else {
-  // this uses value 0 for message id from frontend
-  // let the main thread to execute ctrl, which is necessary for python
-  exec_.Exec([this, recved]() {
-  CHECK(controller_);
-  controller_(recved.head, recved.body);
-});
+switch (recved_type) {
+  case CommandType::kStopServer:
+exec_.Stop();
+break;
+  case CommandType::kSyncMode:
+sync_mode_ = true;
+break;
+  case CommandType::kSetGradientCompression:
+gradient_compression_->DecodeParams(recved.body);
+break;
+  case CommandType::kSetProfilerParams:
+// last char is the type of profiler command
+ProcessServerProfilerCommands(static_cast
+  (recved.body.back() - '0'),
+  recved.body);
+break;
+  case CommandType::kController:
+// this uses value 0 for message id from frontend
+// let the main thread to execute ctrl, which is necessary for python
+exec_.Exec([this, recved]() {
+CHECK(controller_);
+controller_(recved.head, recved.body);
+  });
+break;
 }
 app->Response(recved);
   }
 
+  void ProcessServerProfilerCommands(KVStoreServerProfilerCommand type, const 
std::string& body) {
+switch (type) {
+  case KVStoreServerProfilerCommand::kSetConfig:
+SetProfilerConfig(body.substr(0, body.size() - 1));
+break;
+  case KVStoreServerProfilerCommand::kState:
+MXSetProfilerState(static_cast(body.front() - '0'));
+break;
+  case KVStoreServerProfilerCommand::kPause:
+MXProfilePause(static_cast(body.front() - '0'));
+break;
+  case KVStoreServerProfilerCommand::kDump:
+MXDumpProfile(static_cast(body.front() - '0'));
+break;
+}
+  }
+
+  void SetProfilerConfig(std::string params_str) {
+std::vector elems;
+mxnet::kvstore::split(params_str, ',', std::back_inserter(elems));
+std::vector ckeys;
+std::vector cvals;
+ckeys.reserve(elems.size());
+cvals.reserve(elems.size());
+
+for (int i=0; i < elems.size(); i++) {
+  std::vector parts;
+  mxnet::kvstore::split(elems[i], ':', std::back_inserter(parts));
+  CHECK(!parts[0].empty());
+  CHECK(!parts[1].empty());
 
 Review comment:
   Is this possible ? Can we use LOG(FATAL) , for better error messaging when 
it fails ?


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


With regards,
Apache Git Services


[GitHub] piiswrong closed pull request #9904: Improve workspace in convolution/deconvolution

2018-03-01 Thread GitBox
piiswrong closed pull request #9904: Improve workspace in 
convolution/deconvolution
URL: https://github.com/apache/incubator-mxnet/pull/9904
 
 
   

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/convolution_v1-inl.h 
b/src/operator/convolution_v1-inl.h
index bc6326aad76..d8310e6f1fc 100644
--- a/src/operator/convolution_v1-inl.h
+++ b/src/operator/convolution_v1-inl.h
@@ -76,7 +76,11 @@ struct ConvolutionV1Param : public 
dmlc::Parameter {
 .describe("Number of group partitions. Equivalent to slicing input into 
num_group\n"
   "partitions, apply convolution on each, then concatenate the 
results");
 DMLC_DECLARE_FIELD(workspace).set_default(1024).set_range(0, 8192)
-.describe("Maximum tmp workspace allowed for convolution (MB).");
+.describe("Maximum temporary workspace allowed for convolution (MB)."
+  "This parameter determines the effective batch size of the 
convolution "
+  "kernel, which may be smaller than the given batch size. "
+  "Also, the workspace will be automatically enlarged to make sure 
that we can "
+  "run the kernel with batch_size=1");
 DMLC_DECLARE_FIELD(no_bias).set_default(false)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
@@ -344,9 +348,6 @@ class ConvolutionV1Op : public Operator {
  shape_dstunit_[1],
  shape_dstunit_[2] * nstep_);
 index_t required_size = scol.Size() + sdst.Size();
-CHECK_GE(param_.workspace, required_size)
-  << "\nMinimum workspace size: " << required_size * sizeof(DType) << " 
Bytes\n"
-  << "Given: " << param_.workspace * sizeof(DType) << " Bytes";
 return required_size;
   }
 
diff --git a/src/operator/nn/convolution-inl.h 
b/src/operator/nn/convolution-inl.h
index 6204f75c469..d0dd7dd27a6 100644
--- a/src/operator/nn/convolution-inl.h
+++ b/src/operator/nn/convolution-inl.h
@@ -79,7 +79,11 @@ struct ConvolutionParam : public 
dmlc::Parameter {
 DMLC_DECLARE_FIELD(num_group).set_default(1)
 .describe("Number of group partitions.");
 DMLC_DECLARE_FIELD(workspace).set_default(1024).set_range(0, 8192)
-.describe("Maximum temporary workspace allowed for convolution (MB).");
+.describe("Maximum temporary workspace allowed (MB) in convolution."
+  "This parameter has two usages. When CUDNN is not used, it 
determines the "
+  "effective batch size of the convolution kernel. When CUDNN is 
used, it controls "
+  "the maximum temporary storage used for tuning the best CUDNN 
kernel when "
+  "`limited_workspace` strategy is used.");
 DMLC_DECLARE_FIELD(no_bias).set_default(false)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
diff --git a/src/operator/nn/deconvolution-inl.h 
b/src/operator/nn/deconvolution-inl.h
index b6d522b9e6f..badbb8b9d67 100644
--- a/src/operator/nn/deconvolution-inl.h
+++ b/src/operator/nn/deconvolution-inl.h
@@ -90,7 +90,11 @@ struct DeconvolutionParam : public 
dmlc::Parameter {
 DMLC_DECLARE_FIELD(num_group).set_default(1)
 .describe("Number of groups partition.");
 DMLC_DECLARE_FIELD(workspace).set_default(512).set_range(0, 8192)
-  .describe("Maximum temporal workspace allowed for deconvolution (MB).");
+.describe("Maximum temporary workspace allowed (MB) in deconvolution."
+  "This parameter has two usages. When CUDNN is not used, it 
determines the "
+  "effective batch size of the deconvolution kernel. When 
CUDNN is used, "
+  "it controls the maximum temporary storage used for tuning "
+  "the best CUDNN kernel when `limited_workspace` strategy is 
used.");
 DMLC_DECLARE_FIELD(no_bias).set_default(true)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
@@ -200,7 +204,7 @@ class DeconvolutionOp {
   void Init(DeconvolutionParam p) {
 this->param_ = p;
 // convert MBytes first to Bytes and then to elements.
-param_.workspace = (param_.workspace << 20) / sizeof(real_t);
+param_.workspace = (param_.workspace << 20) / sizeof(DType);
   }
 
   void Forward(const OpContext ,
@@ -451,7 +455,7 @@ class DeconvolutionOp {
 shape_dstunit_ = mshadow::Shape3(param_.num_group,
  oshape[1] / param_.num_group,
  oshape[2] * oshape[3]);
-// See convolution for workspace calculations
+// See convolution for workspace calculations. nstep_ will be the 
effective batch size
 nstep_ = std::max(
 std::min(
 

[incubator-mxnet] branch master updated: Improve workspace in convolution/deconvolution (#9904)

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

jxie 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 c7f9331  Improve workspace in convolution/deconvolution (#9904)
c7f9331 is described below

commit c7f9331f0687e6847e6355a3ae670a096cee714e
Author: Xingjian Shi 
AuthorDate: Thu Mar 1 11:30:18 2018 -0800

Improve workspace in convolution/deconvolution (#9904)

* Improve workspace in convolution/deconvolution

Revise the description of the workspace parameter. Also, refine the 
workspace after the effective batch size is determined

* fix lint

* no need to update workspace
---
 src/operator/convolution_v1-inl.h   |  9 +
 src/operator/nn/convolution-inl.h   |  6 +-
 src/operator/nn/deconvolution-inl.h | 13 +++--
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/src/operator/convolution_v1-inl.h 
b/src/operator/convolution_v1-inl.h
index bc6326a..d8310e6 100644
--- a/src/operator/convolution_v1-inl.h
+++ b/src/operator/convolution_v1-inl.h
@@ -76,7 +76,11 @@ struct ConvolutionV1Param : public 
dmlc::Parameter {
 .describe("Number of group partitions. Equivalent to slicing input into 
num_group\n"
   "partitions, apply convolution on each, then concatenate the 
results");
 DMLC_DECLARE_FIELD(workspace).set_default(1024).set_range(0, 8192)
-.describe("Maximum tmp workspace allowed for convolution (MB).");
+.describe("Maximum temporary workspace allowed for convolution (MB)."
+  "This parameter determines the effective batch size of the 
convolution "
+  "kernel, which may be smaller than the given batch size. "
+  "Also, the workspace will be automatically enlarged to make sure 
that we can "
+  "run the kernel with batch_size=1");
 DMLC_DECLARE_FIELD(no_bias).set_default(false)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
@@ -344,9 +348,6 @@ class ConvolutionV1Op : public Operator {
  shape_dstunit_[1],
  shape_dstunit_[2] * nstep_);
 index_t required_size = scol.Size() + sdst.Size();
-CHECK_GE(param_.workspace, required_size)
-  << "\nMinimum workspace size: " << required_size * sizeof(DType) << " 
Bytes\n"
-  << "Given: " << param_.workspace * sizeof(DType) << " Bytes";
 return required_size;
   }
 
diff --git a/src/operator/nn/convolution-inl.h 
b/src/operator/nn/convolution-inl.h
index 6204f75..d0dd7dd 100644
--- a/src/operator/nn/convolution-inl.h
+++ b/src/operator/nn/convolution-inl.h
@@ -79,7 +79,11 @@ struct ConvolutionParam : public 
dmlc::Parameter {
 DMLC_DECLARE_FIELD(num_group).set_default(1)
 .describe("Number of group partitions.");
 DMLC_DECLARE_FIELD(workspace).set_default(1024).set_range(0, 8192)
-.describe("Maximum temporary workspace allowed for convolution (MB).");
+.describe("Maximum temporary workspace allowed (MB) in convolution."
+  "This parameter has two usages. When CUDNN is not used, it 
determines the "
+  "effective batch size of the convolution kernel. When CUDNN is 
used, it controls "
+  "the maximum temporary storage used for tuning the best CUDNN 
kernel when "
+  "`limited_workspace` strategy is used.");
 DMLC_DECLARE_FIELD(no_bias).set_default(false)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
diff --git a/src/operator/nn/deconvolution-inl.h 
b/src/operator/nn/deconvolution-inl.h
index b6d522b..badbb8b 100644
--- a/src/operator/nn/deconvolution-inl.h
+++ b/src/operator/nn/deconvolution-inl.h
@@ -90,7 +90,11 @@ struct DeconvolutionParam : public 
dmlc::Parameter {
 DMLC_DECLARE_FIELD(num_group).set_default(1)
 .describe("Number of groups partition.");
 DMLC_DECLARE_FIELD(workspace).set_default(512).set_range(0, 8192)
-  .describe("Maximum temporal workspace allowed for deconvolution (MB).");
+.describe("Maximum temporary workspace allowed (MB) in deconvolution."
+  "This parameter has two usages. When CUDNN is not used, it 
determines the "
+  "effective batch size of the deconvolution kernel. When 
CUDNN is used, "
+  "it controls the maximum temporary storage used for tuning "
+  "the best CUDNN kernel when `limited_workspace` strategy is 
used.");
 DMLC_DECLARE_FIELD(no_bias).set_default(true)
 .describe("Whether to disable bias parameter.");
 DMLC_DECLARE_FIELD(cudnn_tune)
@@ -200,7 +204,7 @@ class DeconvolutionOp {
   void Init(DeconvolutionParam p) {
 this->param_ = p;
 // convert MBytes first to Bytes and then to elements.
-param_.workspace = (param_.workspace 

[GitHub] piiswrong commented on issue #9869: Exception handling documentation

2018-03-01 Thread GitBox
piiswrong commented on issue #9869: Exception handling documentation
URL: https://github.com/apache/incubator-mxnet/pull/9869#issuecomment-369703157
 
 
   It can be documented in archetecture design docs.
   Non-developpers shouldn't need to be aware of this.


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] ZiyueHuang commented on a change in pull request #9942: add SameType as default type inference function in imperative mode

2018-03-01 Thread GitBox
ZiyueHuang commented on a change in pull request #9942: add SameType as default 
type inference function in imperative mode
URL: https://github.com/apache/incubator-mxnet/pull/9942#discussion_r171668008
 
 

 ##
 File path: src/executor/exec_pass.h
 ##
 @@ -189,6 +189,13 @@ bool DefaultStorageType(const nnvm::NodeAttrs& attrs,
 std::vector *iattr,
 std::vector *oattr);
 
+/*! \brief The default type inference function, which assigns all undefined
+ * types to the same type of one of the inputs or outputs.
+ */
+bool SameType(const nnvm::NodeAttrs& attrs,
 
 Review comment:
   Sure. Will update it tomorrow.


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] piiswrong commented on issue #9869: Exception handling documentation

2018-03-01 Thread GitBox
piiswrong commented on issue #9869: Exception handling documentation
URL: https://github.com/apache/incubator-mxnet/pull/9869#issuecomment-369703157
 
 
   It can be documented in archetecture design docs.
   


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 #9942: add SameType as default type inference function in imperative mode

2018-03-01 Thread GitBox
reminisce commented on a change in pull request #9942: add SameType as default 
type inference function in imperative mode
URL: https://github.com/apache/incubator-mxnet/pull/9942#discussion_r171666952
 
 

 ##
 File path: src/executor/exec_pass.h
 ##
 @@ -189,6 +189,13 @@ bool DefaultStorageType(const nnvm::NodeAttrs& attrs,
 std::vector *iattr,
 std::vector *oattr);
 
+/*! \brief The default type inference function, which assigns all undefined
+ * types to the same type of one of the inputs or outputs.
+ */
+bool SameType(const nnvm::NodeAttrs& attrs,
 
 Review comment:
   Can we move the definition to some file in `src/common` for better code 
management? It's kind of confusing to declare it here and define it in a file 
not related to the caller.


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 #9942: add SameType as default type inference function in imperative mode

2018-03-01 Thread GitBox
reminisce commented on a change in pull request #9942: add SameType as default 
type inference function in imperative mode
URL: https://github.com/apache/incubator-mxnet/pull/9942#discussion_r171664073
 
 

 ##
 File path: src/imperative/imperative_utils.h
 ##
 @@ -120,9 +120,13 @@ inline void SetShapeType(const Context& ctx,
   for (auto& i : outputs) {
 out_types.push_back(i->dtype());
   }
-  CHECK(infertype.count(attrs.op))
-<< "Operator " << attrs.op->name << " is missing FInferType attribute";
-  CHECK(infertype[attrs.op](attrs, _types, _types));
+  bool infer_type_success;
 
 Review comment:
   nit: initialize the variable with `false`.


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


With regards,
Apache Git Services


[GitHub] yzhliu commented on a change in pull request #9931: Add axes support to Dropout for variational dropout in NLP

2018-03-01 Thread GitBox
yzhliu commented on a change in pull request #9931: Add axes support to Dropout 
for variational dropout in NLP
URL: https://github.com/apache/incubator-mxnet/pull/9931#discussion_r171664485
 
 

 ##
 File path: src/operator/nn/dropout-inl.h
 ##
 @@ -228,11 +301,27 @@ class DropoutOp {
 if (!MKLForward(s, pgen, this->pkeep_, in_data, out_data)) {
   const TBlob  = out_data[dropout::kMask];
   CHECK(req[dropout::kOut] != kAddTo);
-  LaunchRNG(s, pgen, out.Size(),
-out.dptr(),
-mask.dptr(),
-in_data[dropout::kData].dptr(),
-this->pkeep_);
+  // initialize the mask
+  LaunchRNG(s, pgen, out.Size(),
+  mask.dptr(),
+  this->pkeep_);
+  if (req[0] != kNullOp) {
+// broardcast mul
 
 Review comment:
   typo broadcast


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] yzhliu commented on a change in pull request #9931: Add axes support to Dropout for variational dropout in NLP

2018-03-01 Thread GitBox
yzhliu commented on a change in pull request #9931: Add axes support to Dropout 
for variational dropout in NLP
URL: https://github.com/apache/incubator-mxnet/pull/9931#discussion_r171660676
 
 

 ##
 File path: src/operator/nn/dropout.cc
 ##
 @@ -93,10 +93,16 @@ Example::
   std::vector *in_shape, std::vector *out_shape){
   using namespace mshadow;
   CHECK_EQ(in_shape->size(), 1U);
-  const TShape  = in_shape->at(0);
+  const DropoutParam& param = nnvm::get(attrs.parsed);
+  TShape dshape(in_shape->at(0));
   if (dshape.ndim() == 0) return false;
   out_shape->clear();
   out_shape->push_back(dshape);
+  if (param.axes.ndim() != 0) {
 
 Review comment:
   can be removed


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] yzhliu commented on a change in pull request #9931: Add axes support to Dropout for variational dropout in NLP

2018-03-01 Thread GitBox
yzhliu commented on a change in pull request #9931: Add axes support to Dropout 
for variational dropout in NLP
URL: https://github.com/apache/incubator-mxnet/pull/9931#discussion_r171664450
 
 

 ##
 File path: src/operator/nn/dropout-inl.h
 ##
 @@ -228,11 +301,27 @@ class DropoutOp {
 if (!MKLForward(s, pgen, this->pkeep_, in_data, out_data)) {
   const TBlob  = out_data[dropout::kMask];
   CHECK(req[dropout::kOut] != kAddTo);
-  LaunchRNG(s, pgen, out.Size(),
-out.dptr(),
-mask.dptr(),
-in_data[dropout::kData].dptr(),
-this->pkeep_);
+  // initialize the mask
+  LaunchRNG(s, pgen, out.Size(),
+  mask.dptr(),
+  this->pkeep_);
+  if (req[0] != kNullOp) {
+// broardcast mul
+TShape new_lshape, new_rshape, new_oshape;
+int ndim = 
BinaryBroadcastShapeCompact(in_data[dropout::kData].shape_,
+   mask.shape_, out.shape_,
+   _lshape, _rshape, 
_oshape);
+BROADCAST_NDIM_SWITCH(ndim, NDim, {
+  mshadow::Shape oshape = new_oshape.get();
+  mshadow::Shape lstride = 
mxnet_op::calc_stride(new_lshape.get());
+  mshadow::Shape rstride = 
mxnet_op::calc_stride(new_rshape.get());
+  mxnet_op::Kernel, xpu>::
+  template LaunchEx(s, new_oshape.Size(), req[0], lstride, 
rstride, oshape,
+  in_data[dropout::kData].dptr(),
+  mask.dptr(), out.dptr());
+});
+  }
 }
 
 Review comment:
   if MKL enables, the broadcast will not happen?


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 #8671: Discussion and troubleshooting on PyPI (pip) installation

2018-03-01 Thread GitBox
szha commented on issue #8671: Discussion and troubleshooting on PyPI (pip) 
installation
URL: 
https://github.com/apache/incubator-mxnet/issues/8671#issuecomment-369701151
 
 
   @yajiedesign is working on it.


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


With regards,
Apache Git Services


[GitHub] yzhliu commented on a change in pull request #9931: Add axes support to Dropout for variational dropout in NLP

2018-03-01 Thread GitBox
yzhliu commented on a change in pull request #9931: Add axes support to Dropout 
for variational dropout in NLP
URL: https://github.com/apache/incubator-mxnet/pull/9931#discussion_r171661722
 
 

 ##
 File path: src/operator/nn/dropout-inl.h
 ##
 @@ -67,9 +70,92 @@ struct DropoutParam : public dmlc::Parameter {
 .add_enum("always", dropout::kAlways)
 .set_default(dropout::kTraining)
 .describe("Whether to only turn on dropout during training or to also turn 
on for inference.");
+DMLC_DECLARE_FIELD(axes).set_default(TShape())
+.describe("Axes for variational dropout kernel.");
   }
 };  // struct DropoutParam
 
+namespace mxnet_op {
+template
+struct binary_broadcast_kernel {
+  /*! \brief Map function for binary_broadcast_kernel */
+  MSHADOW_XINLINE static void Map(int base, int length, OpReqType req,
+  const Shape  , const Shape 
 ,
+  const Shape  , DType *lhs, 
DType *rhs,
+  DType *out) {
+Shape  coord = unravel(base, oshape);
+auto lidx = static_cast(dot(coord, lstride));
+auto ridx = static_cast(dot(coord, rstride));
+KERNEL_ASSIGN(out[base], req, OP::Map(lhs[lidx], rhs[ridx]));
+// starts from 1 to avoid extra inc at end of loop
+for (int i = 1; i < length; ++i) {
+  inc(, oshape, , lstride, , rstride);
+  // When tuning, don't actually run the op, since it's not going to be 
tuned against
+  // the actual op we'll eventually be using
 
 Review comment:
   cannot quite get the point.


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: Add force_deterministic option for sparse embedding (#9882)

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

jxie 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 b8b869f  Add force_deterministic option for sparse embedding (#9882)
b8b869f is described below

commit b8b869fe1998a4f380ed96ed62e9799e2c231880
Author: Haibin Lin 
AuthorDate: Fri Mar 2 03:19:54 2018 +0800

Add force_deterministic option for sparse embedding (#9882)

* refactor embed backward kernelcallker

* pass unit test

* refactor

* fix dim bug

* add unique impl

* remove old op

* remove unused kernel

* Revert "remove unused kernel"

This reverts commit 948c5a35e124d69208127af17a0e149731697b79.

* Revert "remove old op"

This reverts commit 5d1cd64840676f25f50b3ac5ced849867af3112a.

* fix kernellaucnher

* add force_determ option

* add doc

* fix lint

* update test

* CR comments

* lint

* set grad to be 0s initially

* add warning
---
 src/operator/tensor/indexing_op-inl.cuh   | 113 ---
 src/operator/tensor/indexing_op.cc|  20 ++-
 src/operator/tensor/indexing_op.cu| 197 +-
 src/operator/tensor/indexing_op.h |  41 +-
 tests/python/unittest/test_sparse_operator.py |  66 -
 5 files changed, 342 insertions(+), 95 deletions(-)

diff --git a/src/operator/tensor/indexing_op-inl.cuh 
b/src/operator/tensor/indexing_op-inl.cuh
index 4458151..34cc263 100644
--- a/src/operator/tensor/indexing_op-inl.cuh
+++ b/src/operator/tensor/indexing_op-inl.cuh
@@ -200,57 +200,15 @@ AddTakeGradLargeBatchWorkspaceSize(size_t num_keys) {
 }
 
 template
-inline void AddTakeGradLargeBatch(mshadow::Tensor dst,
-  const mshadow::Tensor& 
sorted,
-  const mshadow::Tensor& 
index,
-  const mshadow::Tensor ,
-  mshadow::Tensor* workspace) {
-  CHECK_EQ(dst.CheckContiguous(), true);
-  CHECK_EQ(sorted.CheckContiguous(), true);
-  CHECK_EQ(index.CheckContiguous(), true);
-  CHECK_EQ(src.CheckContiguous(), true);
-  // const int kWarpBits = kMemUnitBits;
+inline void AddTakeGradLargeBatchKernelLaunch(mshadow::Tensor 
dst,
+  const mshadow::Tensor& sorted,
+  const mshadow::Tensor& index,
+  const mshadow::Tensor ,
+  IndexType* sum_counts_ptr,
+  int* num_runs_ptr,
+  const mshadow::index_t num_rows) 
{
   cudaStream_t stream = mshadow::Stream::GetStream(dst.stream_);
-  IndexType* sum_counts_ptr = NULL;
-  int* num_runs_ptr = NULL;
-  if (dst.size(0)*4 < src.size(0) && workspace != NULL) {
-// Workspace given and potentially loops at least 4 times, use CUB to 
create sum_counts
-CHECK_EQ(workspace->CheckContiguous(), true);
-// workspace = [unique_out, counts_out, temporary_storage]
-size_t unique_bytes = sorted.size(0)*sizeof(IndexType);
-size_t counts_bytes = sorted.size(0)*sizeof(IndexType);
-size_t num_runs_bytes = 1*sizeof(int);
-
-size_t encode_bytes = 0;
-cub::DeviceRunLengthEncode::Encode
-  (NULL, encode_bytes, NULL, NULL, NULL, NULL, sorted.size(0), stream);
-size_t exclusivesum_bytes = 0;
-cub::DeviceScan::ExclusiveSum
-  (NULL, exclusivesum_bytes, NULL, NULL, sorted.size(0), stream);
-size_t temporary_bytes = std::max(encode_bytes, exclusivesum_bytes);
-
-// Check that we have enough storage
-CHECK_GE(workspace->size(0), unique_bytes + counts_bytes +
-  num_runs_bytes + temporary_bytes);
-
-IndexType* unique_out_ptr = reinterpret_cast(workspace->dptr_);
-IndexType* counts_out_ptr = reinterpret_cast(workspace->dptr_ 
+ unique_bytes);
-num_runs_ptr = reinterpret_cast(workspace->dptr_ + unique_bytes +
-  counts_bytes);
-void* temporary_storage = reinterpret_cast(workspace->dptr_ + 
unique_bytes +
-  counts_bytes + num_runs_bytes);
-
-cub::DeviceRunLengthEncode::Encode
-(temporary_storage, temporary_bytes, sorted.dptr_, unique_out_ptr, 
counts_out_ptr,
-  num_runs_ptr, sorted.size(0), stream);
-
-sum_counts_ptr = unique_out_ptr;
-cub::DeviceScan::ExclusiveSum
-(temporary_storage, 

[GitHub] piiswrong closed pull request #9882: Add force_deterministic option for sparse embedding

2018-03-01 Thread GitBox
piiswrong closed pull request #9882: Add force_deterministic option for sparse 
embedding
URL: https://github.com/apache/incubator-mxnet/pull/9882
 
 
   

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/tensor/indexing_op-inl.cuh 
b/src/operator/tensor/indexing_op-inl.cuh
index 4458151f178..34cc2630254 100644
--- a/src/operator/tensor/indexing_op-inl.cuh
+++ b/src/operator/tensor/indexing_op-inl.cuh
@@ -200,57 +200,15 @@ AddTakeGradLargeBatchWorkspaceSize(size_t num_keys) {
 }
 
 template
-inline void AddTakeGradLargeBatch(mshadow::Tensor dst,
-  const mshadow::Tensor& 
sorted,
-  const mshadow::Tensor& 
index,
-  const mshadow::Tensor ,
-  mshadow::Tensor* workspace) {
-  CHECK_EQ(dst.CheckContiguous(), true);
-  CHECK_EQ(sorted.CheckContiguous(), true);
-  CHECK_EQ(index.CheckContiguous(), true);
-  CHECK_EQ(src.CheckContiguous(), true);
-  // const int kWarpBits = kMemUnitBits;
+inline void AddTakeGradLargeBatchKernelLaunch(mshadow::Tensor 
dst,
+  const mshadow::Tensor& sorted,
+  const mshadow::Tensor& index,
+  const mshadow::Tensor ,
+  IndexType* sum_counts_ptr,
+  int* num_runs_ptr,
+  const mshadow::index_t num_rows) 
{
   cudaStream_t stream = mshadow::Stream::GetStream(dst.stream_);
-  IndexType* sum_counts_ptr = NULL;
-  int* num_runs_ptr = NULL;
-  if (dst.size(0)*4 < src.size(0) && workspace != NULL) {
-// Workspace given and potentially loops at least 4 times, use CUB to 
create sum_counts
-CHECK_EQ(workspace->CheckContiguous(), true);
-// workspace = [unique_out, counts_out, temporary_storage]
-size_t unique_bytes = sorted.size(0)*sizeof(IndexType);
-size_t counts_bytes = sorted.size(0)*sizeof(IndexType);
-size_t num_runs_bytes = 1*sizeof(int);
-
-size_t encode_bytes = 0;
-cub::DeviceRunLengthEncode::Encode
-  (NULL, encode_bytes, NULL, NULL, NULL, NULL, sorted.size(0), stream);
-size_t exclusivesum_bytes = 0;
-cub::DeviceScan::ExclusiveSum
-  (NULL, exclusivesum_bytes, NULL, NULL, sorted.size(0), stream);
-size_t temporary_bytes = std::max(encode_bytes, exclusivesum_bytes);
-
-// Check that we have enough storage
-CHECK_GE(workspace->size(0), unique_bytes + counts_bytes +
-  num_runs_bytes + temporary_bytes);
-
-IndexType* unique_out_ptr = reinterpret_cast(workspace->dptr_);
-IndexType* counts_out_ptr = reinterpret_cast(workspace->dptr_ 
+ unique_bytes);
-num_runs_ptr = reinterpret_cast(workspace->dptr_ + unique_bytes +
-  counts_bytes);
-void* temporary_storage = reinterpret_cast(workspace->dptr_ + 
unique_bytes +
-  counts_bytes + num_runs_bytes);
-
-cub::DeviceRunLengthEncode::Encode
-(temporary_storage, temporary_bytes, sorted.dptr_, unique_out_ptr, 
counts_out_ptr,
-  num_runs_ptr, sorted.size(0), stream);
-
-sum_counts_ptr = unique_out_ptr;
-cub::DeviceScan::ExclusiveSum
-(temporary_storage, temporary_bytes, counts_out_ptr, sum_counts_ptr,
-  sorted.size(0), stream);
-  }
-
-  const int num_unique_est = min(dst.size(0), src.size(0));
+  const int num_unique_est = min(num_rows, src.size(0));
   const int max_nthread = 128;
   const int num_y = max(src.size(0)/num_unique_est, 1);
   const int block_dim_x = kWarpSize;
@@ -307,6 +265,61 @@ inline void AddTakeGradLargeBatch(mshadow::Tensor dst,
   MSHADOW_CUDA_POST_KERNEL_CHECK(AddTakeGradLargeBatchKernel);
 }
 
+
+template
+inline void AddTakeGradLargeBatch(mshadow::Tensor dst,
+  const mshadow::Tensor& 
sorted,
+  const mshadow::Tensor& 
index,
+  const mshadow::Tensor ,
+  mshadow::Tensor* workspace) {
+  CHECK_EQ(dst.CheckContiguous(), true);
+  CHECK_EQ(sorted.CheckContiguous(), true);
+  CHECK_EQ(index.CheckContiguous(), true);
+  CHECK_EQ(src.CheckContiguous(), true);
+  // const int kWarpBits = kMemUnitBits;
+  cudaStream_t stream = 

[GitHub] piiswrong commented on a change in pull request #9930: Support single array input for metric

2018-03-01 Thread GitBox
piiswrong commented on a change in pull request #9930: Support single array 
input for metric
URL: https://github.com/apache/incubator-mxnet/pull/9930#discussion_r171662699
 
 

 ##
 File path: python/mxnet/metric.py
 ##
 @@ -793,6 +793,8 @@ def update(self, labels, preds):
 
 if len(label.shape) == 1:
 label = label.reshape(label.shape[0], 1)
+if len(pred.shape) == 1:
+pred = pred.reshape(pred.shape[0], 1)
 
 
 Review comment:
   I think the check_label_shapes function should be redesigned.
   1. it should test if labels is a single NDArray instead of a list, and wrap 
it with a list `labels=[labels]`
   2. 0/1 is not pythonic. Use boolean switches
   


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 opened a new issue #9948: [Doc] Overlapping between footer and the left column + Strange nav-link highlighting

2018-03-01 Thread GitBox
sxjscience opened a new issue #9948: [Doc] Overlapping between footer and the 
left column + Strange nav-link highlighting
URL: https://github.com/apache/incubator-mxnet/issues/9948
 
 
   1. Footer looks strange:
   See 
https://mxnet.incubator.apache.org/versions/1.1.0/architecture/index.html and 
https://mxnet.incubator.apache.org/versions/1.1.0/api/c++/index.html There is 
overlapping between the footer and the left column.
   2. The chosen nav-link is not highlighted. The current behavior is quite 
strange.
   Click Docs - Architectures and the `Github` is highlighted.
   Click Docs - Tutorials and the `Gluon` is highlighted.
   
   


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 #9932: Fixing couple of bugs in profiler

2018-03-01 Thread GitBox
rahul003 commented on issue #9932: Fixing couple of bugs in profiler
URL: https://github.com/apache/incubator-mxnet/pull/9932#issuecomment-369696948
 
 
   @marcoabreu Looks like this test `test_gluon_model_zoo_gpu.test_training` is 
failing. My PR should not have anything to do with that. 
   Have you seen this test fail before? 


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


With regards,
Apache Git Services


[GitHub] anirudh2290 commented on a change in pull request #9932: Fixing couple of bugs in profiler

2018-03-01 Thread GitBox
anirudh2290 commented on a change in pull request #9932: Fixing couple of bugs 
in profiler
URL: https://github.com/apache/incubator-mxnet/pull/9932#discussion_r171660539
 
 

 ##
 File path: src/profiler/profiler.cc
 ##
 @@ -205,19 +205,14 @@ void Profiler::DumpProfile(bool peform_cleanup) {
   // If aggregate stats aren't enabled, this won't cause a locked instruction
   std::shared_ptr ptr_aggregate_stats = aggregate_stats_.get()
 ? aggregate_stats_ : 
nullptr;
-  bool first_flag = !first_pass && !num_records_emitted_;
   for (uint32_t i = 0; i < dev_num; ++i) {
 DeviceStats  = profile_stat[i];
 ProfileStat *_opr_stat;
 while (d.opr_exec_stats_->try_dequeue(_opr_stat)) {
   CHECK_NOTNULL(_opr_stat);
   std::unique_ptr opr_stat(_opr_stat);  // manage lifecycle
   opr_stat->process_id_ = i;  // lie and set process id to be the device 
number
-  if (first_flag) {
-first_flag = false;
-  } else {
-file << ",\n";
-  }
+  file << ",\n";
 
 Review comment:
   Do we need this ? Also is there a reason not to use std::endl ?


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] ZiyueHuang commented on a change in pull request #9942: add SameType as default type inference function in imperative mode

2018-03-01 Thread GitBox
ZiyueHuang commented on a change in pull request #9942: add SameType as default 
type inference function in imperative mode
URL: https://github.com/apache/incubator-mxnet/pull/9942#discussion_r171660046
 
 

 ##
 File path: src/executor/exec_pass.h
 ##
 @@ -189,6 +189,13 @@ bool DefaultStorageType(const nnvm::NodeAttrs& attrs,
 std::vector *iattr,
 std::vector *oattr);
 
+/*! \brief The default type inference function, which assigns all undefined
+ * types to the same type of one of the inputs or outputs.
+ */
+bool SameType(const nnvm::NodeAttrs& attrs,
 
 Review comment:
   I tried global search SameType in github. It only appears twice in 
infer_graph_attr_pass.cc 
https://github.com/apache/incubator-mxnet/search?utf8=?=SameType=


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


With regards,
Apache Git Services


  1   2   3   >