[GitHub] anirudh2290 opened a new pull request #10833: [WIP] Change class variables to thread local variables

2018-05-06 Thread GitBox
anirudh2290 opened a new pull request #10833: [WIP] Change class variables to 
thread local variables
URL: https://github.com/apache/incubator-mxnet/pull/10833
 
 
   ## Description ##
   
   There are many places where class variables which end up modifying the state 
from multiple threads and causing issues like the one here: 
https://github.com/apache/incubator-mxnet/issues/9920 .
   This PR is currently WIP because  more investigation is required on  
`test_multi_worker_forked_data_loader` and `test_laop_3`(able to reproduce this 
test failure without my changes also). 
   
   @piiswrong 
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] 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


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

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

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


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

commit 0b29b046b7bd523b09930570fd81bf55a51c92db
Author: mxnet-ci 
AuthorDate: Mon May 7 01:57:02 2018 +

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

diff --git a/date.txt b/date.txt
new file mode 100644
index 000..6d3e926
--- /dev/null
+++ b/date.txt
@@ -0,0 +1 @@
+Mon May  7 01:57:02 UTC 2018

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


[GitHub] pribadihcr opened a new issue #10832: custom kernel

2018-05-06 Thread GitBox
pribadihcr opened a new issue #10832: custom kernel
URL: https://github.com/apache/incubator-mxnet/issues/10832
 
 
   HI,
   How to make custom kernel for mxnet convolution like the following tf 
version:
   def gauss_kernel(kernlen=21, nsig=3, channels=1):
   interval = (2*nsig+1.)/(kernlen)
   x = np.linspace(-nsig-interval/2., nsig+interval/2., kernlen+1)
   kern1d = np.diff(st.norm.cdf(x))
   kernel_raw = np.sqrt(np.outer(kern1d, kern1d))
   kernel = kernel_raw/kernel_raw.sum()
   out_filter = np.array(kernel, dtype = np.float32)
   out_filter = out_filter.reshape((kernlen, kernlen, 1, 1))
   out_filter = np.repeat(out_filter, channels, axis = 2)
   return out_filter
   
   def blur(x):
   kernel_var = gauss_kernel(21, 3, 3)
   return tf.nn.depthwise_conv2d(x, kernel_var, [1, 1, 1, 1], 
padding='SAME')


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


With regards,
Apache Git Services


[GitHub] ZioPwnstar closed issue #10826: Own dataset via im2rec.py & NDArrayIter

2018-05-06 Thread GitBox
ZioPwnstar closed issue #10826: Own dataset via im2rec.py & NDArrayIter
URL: https://github.com/apache/incubator-mxnet/issues/10826
 
 
   


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


With regards,
Apache Git Services


[GitHub] eric-haibin-lin closed pull request #10813: Fix context handling when creating sparse arrays from definition

2018-05-06 Thread GitBox
eric-haibin-lin closed pull request #10813: Fix context handling when creating 
sparse arrays from definition
URL: https://github.com/apache/incubator-mxnet/pull/10813
 
 
   

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

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

diff --git a/python/mxnet/ndarray/sparse.py b/python/mxnet/ndarray/sparse.py
index c7355c2e46d..c45de54c1ff 100644
--- a/python/mxnet/ndarray/sparse.py
+++ b/python/mxnet/ndarray/sparse.py
@@ -992,10 +992,16 @@ def _csr_matrix_from_definition(data, indices, indptr, 
shape=None, ctx=None,
 # to accept np.ndarray types to copy from to result.data and aux_data
 if not isinstance(data, NDArray):
 data = _array(data, ctx, dtype)
+else:
+data = data.as_in_context(ctx)
 if not isinstance(indptr, NDArray):
 indptr = _array(indptr, ctx, indptr_type)
+else:
+indptr = indptr.as_in_context(ctx)
 if not isinstance(indices, NDArray):
 indices = _array(indices, ctx, indices_type)
+else:
+indices = indices.as_in_context(ctx)
 if shape is None:
 if indices.shape[0] == 0:
 raise ValueError('invalid shape')
@@ -1153,8 +1159,12 @@ def _row_sparse_ndarray_from_definition(data, indices, 
shape=None, ctx=None,
 # to accept np.ndarray types to copy from to result.data and aux_data
 if not isinstance(data, NDArray):
 data = _array(data, ctx, dtype)
+else:
+data = data.as_in_context(ctx)
 if not isinstance(indices, NDArray):
 indices = _array(indices, ctx, indices_type)
+else:
+indices = indices.as_in_context(ctx)
 if shape is None:
 num_indices = indices.shape[0]
 if num_indices == 0:


 


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


With regards,
Apache Git Services


[GitHub] eric-haibin-lin commented on issue #10813: Fix context handling when creating sparse arrays from definition

2018-05-06 Thread GitBox
eric-haibin-lin commented on issue #10813: Fix context handling when creating 
sparse arrays from definition
URL: https://github.com/apache/incubator-mxnet/pull/10813#issuecomment-386920397
 
 
   Thanks for reporting! The fix should be done in cpp (fixed in #10830). 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10830: fix creating cpu sparse array from gpu data

2018-05-06 Thread GitBox
piiswrong closed pull request #10830: fix creating cpu sparse array from gpu 
data
URL: https://github.com/apache/incubator-mxnet/pull/10830
 
 
   

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

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

diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc
index a643da1a8cb..67b4c061eee 100644
--- a/src/ndarray/ndarray.cc
+++ b/src/ndarray/ndarray.cc
@@ -1911,7 +1911,7 @@ void NDArray::SyncCopyFromNDArray(const NDArray& src, int 
i, int j) {
 if (src_dev_mask == cpu::kDevMask && dst_dev_mask == gpu::kDevMask) {
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
@@ -1921,17 +1921,17 @@ void NDArray::SyncCopyFromNDArray(const NDArray& src, 
int i, int j) {
 } else if (src_dev_mask == gpu::kDevMask && dst_dev_mask == cpu::kDevMask) 
{
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
   on_complete();
-}, this->ctx(), const_vars, {this->var()},
+}, src.ctx(), const_vars, {this->var()},
 FnProperty::kCopyFromGPU, 0, "SyncCopyFromNDArrayGPU2CPU");
 } else if (src_dev_mask == gpu::kDevMask && dst_dev_mask == gpu::kDevMask) 
{
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
diff --git a/tests/python/gpu/test_operator_gpu.py 
b/tests/python/gpu/test_operator_gpu.py
index 08c749e597e..313730ca813 100644
--- a/tests/python/gpu/test_operator_gpu.py
+++ b/tests/python/gpu/test_operator_gpu.py
@@ -1834,6 +1834,24 @@ def test_batchnorm_backwards_notrain():
 loss=y.square().sum()
 loss.backward(train_mode=False)
 
+@with_seed()
+def test_create_sparse_ndarray_gpu_to_cpu():
+dim0 = 10
+dim1 = 5
+densities = [0, 0.5, 1]
+for density in densities:
+shape = rand_shape_2d(dim0, dim1)
+matrix = rand_ndarray(shape, 'row_sparse', density)
+data = matrix.data
+indices = matrix.indices
+rsp_created = mx.nd.sparse.row_sparse_array((data, indices), 
shape=shape, ctx=mx.cpu())
+assert rsp_created.stype == 'row_sparse'
+assert same(rsp_created.data.asnumpy(), data.asnumpy())
+assert same(rsp_created.indices.asnumpy(), indices.asnumpy())
+rsp_copy = mx.nd.array(rsp_created)
+assert(same(rsp_copy.asnumpy(), rsp_created.asnumpy()))
+
+
 if __name__ == '__main__':
 import nose
 nose.runmodule()


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above 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: fix creating cpu sparse array from gpu data (#10830)

2018-05-06 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 1968bba  fix creating cpu sparse array from gpu data (#10830)
1968bba is described below

commit 1968bba659bfb6fcc461132aac1729a4f33d5c41
Author: Haibin Lin 
AuthorDate: Sun May 6 13:57:15 2018 -0700

fix creating cpu sparse array from gpu data (#10830)
---
 src/ndarray/ndarray.cc|  8 
 tests/python/gpu/test_operator_gpu.py | 18 ++
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/src/ndarray/ndarray.cc b/src/ndarray/ndarray.cc
index a643da1..67b4c06 100644
--- a/src/ndarray/ndarray.cc
+++ b/src/ndarray/ndarray.cc
@@ -1911,7 +1911,7 @@ void NDArray::SyncCopyFromNDArray(const NDArray& src, int 
i, int j) {
 if (src_dev_mask == cpu::kDevMask && dst_dev_mask == gpu::kDevMask) {
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
@@ -1921,17 +1921,17 @@ void NDArray::SyncCopyFromNDArray(const NDArray& src, 
int i, int j) {
 } else if (src_dev_mask == gpu::kDevMask && dst_dev_mask == cpu::kDevMask) 
{
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
   on_complete();
-}, this->ctx(), const_vars, {this->var()},
+}, src.ctx(), const_vars, {this->var()},
 FnProperty::kCopyFromGPU, 0, "SyncCopyFromNDArrayGPU2CPU");
 } else if (src_dev_mask == gpu::kDevMask && dst_dev_mask == gpu::kDevMask) 
{
   Engine::Get()->PushAsync(
 [&](RunContext rctx, Engine::CallbackOnComplete on_complete) {
-  const TBlob src_data = (i >= 0? src.aux_data(i) : src.data());
+  const TBlob src_data = (i >= 0 ? src.aux_data(i) : src.data());
   TBlob dst_data = get_dst_data(src_data.shape_);
   ndarray::Copy(src_data, _data, src.ctx(), this->ctx(), 
rctx);
   rctx.get_stream()->Wait();
diff --git a/tests/python/gpu/test_operator_gpu.py 
b/tests/python/gpu/test_operator_gpu.py
index 08c749e..313730c 100644
--- a/tests/python/gpu/test_operator_gpu.py
+++ b/tests/python/gpu/test_operator_gpu.py
@@ -1834,6 +1834,24 @@ def test_batchnorm_backwards_notrain():
 loss=y.square().sum()
 loss.backward(train_mode=False)
 
+@with_seed()
+def test_create_sparse_ndarray_gpu_to_cpu():
+dim0 = 10
+dim1 = 5
+densities = [0, 0.5, 1]
+for density in densities:
+shape = rand_shape_2d(dim0, dim1)
+matrix = rand_ndarray(shape, 'row_sparse', density)
+data = matrix.data
+indices = matrix.indices
+rsp_created = mx.nd.sparse.row_sparse_array((data, indices), 
shape=shape, ctx=mx.cpu())
+assert rsp_created.stype == 'row_sparse'
+assert same(rsp_created.data.asnumpy(), data.asnumpy())
+assert same(rsp_created.indices.asnumpy(), indices.asnumpy())
+rsp_copy = mx.nd.array(rsp_created)
+assert(same(rsp_copy.asnumpy(), rsp_created.asnumpy()))
+
+
 if __name__ == '__main__':
 import nose
 nose.runmodule()

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


[GitHub] samhodge commented on issue #9989: Cannot train example gluon style transfer

2018-05-06 Thread GitBox
samhodge commented on issue #9989: Cannot train example gluon style transfer
URL: 
https://github.com/apache/incubator-mxnet/issues/9989#issuecomment-386910106
 
 
   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] reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186251620
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_convolution-inl.h
 ##
 @@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file mkldnn_convolution-inl.h
+ * \brief
+*/
+
+#ifndef MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+#define MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+
+#if MXNET_USE_MKLDNN == 1
+
+#include 
+#include "../convolution-inl.h"
+#include "./mkldnn_ops-inl.h"
+#include "./mkldnn_base-inl.h"
+
+namespace mxnet {
+namespace op {
+
+mkldnn::convolution_forward::primitive_desc GetConvFwdImpl(
+const ConvolutionParam& param, bool is_train, const NDArray ,
 
 Review comment:
   `const bool is_train`


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186251529
 
 

 ##
 File path: src/c_api/c_api_symbolic.cc
 ##
 @@ -595,7 +596,12 @@ int MXQuantizeSymbol(SymbolHandle sym_handle,
 offline.emplace(offline_params[i]);
   }
   g.attrs["offline_params"] = std::make_shared(std::move(offline));
-  g = ApplyPass(std::move(g), "QuantizeGraph");
+#if MXNET_USE_MKLDNN == 1
+  if (dev_type == Context::kCPU)
+g = ApplyPass(std::move(g), "QuantizeGraphCPU");
+  else
+#endif
+g = ApplyPass(std::move(g), "QuantizeGraph");
 
 Review comment:
   Indentation is strange. To improve readability and maintainability, please 
use
   ```cpp
   #if MXNET_USE_MKLDNN == 1
   #else
   #endif
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186251628
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_convolution-inl.h
 ##
 @@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file mkldnn_convolution-inl.h
+ * \brief
+*/
+
+#ifndef MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+#define MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+
+#if MXNET_USE_MKLDNN == 1
+
+#include 
+#include "../convolution-inl.h"
+#include "./mkldnn_ops-inl.h"
+#include "./mkldnn_base-inl.h"
+
+namespace mxnet {
+namespace op {
+
+mkldnn::convolution_forward::primitive_desc GetConvFwdImpl(
+const ConvolutionParam& param, bool is_train, const NDArray ,
+const NDArray , const NDArray *bias, const NDArray );
 
 Review comment:
   Why is `bias` passed in as a pointer while others are const reference?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186251436
 
 

 ##
 File path: include/mxnet/c_api.h
 ##
 @@ -1423,13 +1423,15 @@ MXNET_DLL int MXSymbolInferType(SymbolHandle sym,
  * \param excluded_symbols array of symbols to be excluded from being quantized
  * \param num_offline number of parameters that are quantized offline
  * \param offline_params array of c strings representing the names of params 
quantized offline
+ * \param dev_type device type 
  */
 MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle,
SymbolHandle *ret_sym_handle,
const mx_uint num_excluded_symbols,
const SymbolHandle *excluded_symbols,
const mx_uint num_offline,
-   const char **offline_params);
+   const char **offline_params,
+   int dev_type);
 
 Review comment:
   I think `dev_type` is not specific enough to infer MKLDNN quantization does 
not need requantize op. There may be other CPU implementations that need 
requantize op. For example, we may use tvm to generate quantized conv kernels 
and requantization might be required there.


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


With regards,
Apache Git Services


[GitHub] reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186299673
 
 

 ##
 File path: python/mxnet/contrib/quantization.py
 ##
 @@ -72,7 +72,7 @@ def _quantize_params(qsym, params):
 return quantized_params
 
 
-def _quantize_symbol(sym, excluded_symbols=None, offline_params=None):
+def _quantize_symbol(sym, excluded_symbols=None, offline_params=None, 
context=cpu()):
 
 Review comment:
   It's better not to define this as default value. We have to be aware of the 
difference between GPU/CPU quantization when calling this function..


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


With regards,
Apache Git Services


[GitHub] reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN support for model quantization

2018-05-06 Thread GitBox
reminisce commented on a change in pull request #10433: [MXNET-290] MKLDNN 
support for model quantization
URL: https://github.com/apache/incubator-mxnet/pull/10433#discussion_r186251602
 
 

 ##
 File path: src/operator/nn/mkldnn/mkldnn_convolution-inl.h
 ##
 @@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/*!
+ * \file mkldnn_convolution-inl.h
+ * \brief
+*/
+
+#ifndef MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+#define MXNET_OPERATOR_NN_MKLDNN_MKLDNN_CONVOLUTION_INL_H_
+
+#if MXNET_USE_MKLDNN == 1
+
+#include 
+#include "../convolution-inl.h"
+#include "./mkldnn_ops-inl.h"
+#include "./mkldnn_base-inl.h"
+
+namespace mxnet {
+namespace op {
+
+mkldnn::convolution_forward::primitive_desc GetConvFwdImpl(
+const ConvolutionParam& param, bool is_train, const NDArray ,
+const NDArray , const NDArray *bias, const NDArray );
+
+class MKLDNNConvForward {
+  std::shared_ptr fwd;
 
 Review comment:
   Coding style suggestions:
   1. add `_` as suffix for data members.
   2. add `private` qualifier explicitly for private members.
   3. move data member definitions to the end of the class.


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


With regards,
Apache Git Services


[GitHub] zzd1992 opened a new issue #10831: How to fix seeds and reproduce results?

2018-05-06 Thread GitBox
zzd1992 opened a new issue #10831: How to fix seeds and reproduce results?
URL: https://github.com/apache/incubator-mxnet/issues/10831
 
 
   My environments:
   ubuntu14.04, python2.7, cuda8.0, cudnn, mxnet-cu80.
   
   I can't reproduce results even set all random seeds. Here is the code:
   ```python
   import mxnet as mx
   import numpy as np
   import random
   
   mx.random.seed(args.seed)
   np.random.seed(args.seed)
   random.seed(args.seed)
   ```
   
   Reproduction is really important in my case?
   How can I reproduce results within my environments?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 pull request #10830: fix creating cpu sparse array from gpu data

2018-05-06 Thread GitBox
eric-haibin-lin opened a new pull request #10830: fix creating cpu sparse array 
from gpu data
URL: https://github.com/apache/incubator-mxnet/pull/10830
 
 
   ## Description ##
   Fix the issue mentioned in #10813 
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] 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] eric-haibin-lin opened a new pull request #10829: [WIP] fix csv iter

2018-05-06 Thread GitBox
eric-haibin-lin opened a new pull request #10829: [WIP] fix csv iter
URL: https://github.com/apache/incubator-mxnet/pull/10829
 
 
   ## Description ##
   (Brief description on what this PR is about)
   
   ## Checklist ##
   ### Essentials ###
   Please feel free to remove inapplicable items for your PR.
   - [ ] The PR title starts with [MXNET-$JIRA_ID], where $JIRA_ID refers to 
the relevant [JIRA issue](https://issues.apache.org/jira/projects/MXNET/issues) 
created (except PRs with tiny changes)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage:
   - Unit tests are added for small changes to verify correctness (e.g. adding 
a new operator)
   - Nightly tests are added for complicated/long-running ones (e.g. changing 
distributed kvstore)
   - Build tests will be added for build configuration changes (e.g. adding a 
new build option with NCCL)
   - [ ] Code is well-documented: 
   - For user-facing API changes, API doc string has been updated. 
   - For new C++ functions in header files, their functionalities and arguments 
are documented. 
   - For new examples, README.md is added to explain the what the example does, 
the source of the dataset, expected performance on test set and reference to 
the original paper if applicable
   - Check the API doc at 
http://mxnet-ci-doc.s3-accelerate.dualstack.amazonaws.com/PR-$PR_ID/$BUILD_ID/index.html
   - [ ] 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] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386885128
 
 
   reproducible 100% with export MXNET_TEST_SEED=1688524483
   
   nosetests-3.4 -s -v test_operator_gpu.py:test_binary_op
   
   
   diff --git a/tests/python/unittest/test_operator.py 
b/tests/python/unittest/test_operator.py
   index 5d38222..04e880c 100644
   --- a/tests/python/unittest/test_operator.py
   +++ b/tests/python/unittest/test_operator.py
   @@ -1429,6 +1429,16 @@ def check_binary_op_backward(symbol, baseline, 
gen_data, rtol=1e-3, atol=1e-5):
y.forward(is_train=True)
y.backward([mx.nd.array(out)])
assert_allclose(y_1.asnumpy(), x_1, rtol=rtol, atol=atol)
   +z = np.abs(y_2.asnumpy() - x_2)
   +w = np.where(z>atol)
   +if w[0].size > 0:
   +print("d[0].shape: {} d[1].shape: {} baseline_grad2.shape: 
{}".format(d[0].shape, d[1].shape, baseline_grad2.shape))
   +print(w)
   +print(y_2[w])
   +print(x_2[w])
   +print(z[w])
   +print(d[0][w])
   +print(d[1][w])
   


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


With regards,
Apache Git Services


[GitHub] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386885128
 
 
   reproducible 100% with export MXNET_TEST_SEED=1688524483
   
   nosetests-3.4 -s -v test_operator_gpu.py:test_binary_op
   
   ```
   diff --git a/tests/python/unittest/test_operator.py 
b/tests/python/unittest/test_operator.py
   index 5d38222..04e880c 100644
   --- a/tests/python/unittest/test_operator.py
   +++ b/tests/python/unittest/test_operator.py
   @@ -1429,6 +1429,16 @@ def check_binary_op_backward(symbol, baseline, 
gen_data, rtol=1e-3, atol=1e-5):
y.forward(is_train=True)
y.backward([mx.nd.array(out)])
assert_allclose(y_1.asnumpy(), x_1, rtol=rtol, atol=atol)
   +z = np.abs(y_2.asnumpy() - x_2)
   +w = np.where(z>atol)
   +if w[0].size > 0:
   +print("d[0].shape: {} d[1].shape: {} baseline_grad2.shape: 
{}".format(d[0].shape, d[1].shape, baseline_grad2.shape))
   +print(w)
   +print(y_2[w])
   +print(x_2[w])
   +print(z[w])
   +print(d[0][w])
   +print(d[1][w])
   ```


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


With regards,
Apache Git Services


[GitHub] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386885067
 
 
   I tried to increase the tolerance, but I found out one failure where the 
difference is much bigger than expected 0.28679015 . I think we should look 
deeper into this
   
   [-116.15162] <-input
   
   [-115.8648288] <- gradient
   [0.28679015] <- diff
   [0.8396868] <- a 
   [0.0020733]  <- b
   FAIL


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


With regards,
Apache Git Services


[GitHub] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386875707
 
 
   I think the cause of this is that operator mod is using doubles to make the 
computation, while the test is forcing float32, also the modulo operator for 
floating point seems to give different results in GPU vs CPU. Why is fmod in 
cuda giving different results?
   
   According to table 7  here 
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#introduction-cuda-dynamic-parallelism
   
   there should be no differences in fmod.
   
   
https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L1511
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/mshadow_op.h#L402
   
   >>> np.double(1.68) % np.double(1.30123)
   0.378769983
   >>> np.float32(1.68) % np.float32(1.30123)
   0.37877
   
   


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


With regards,
Apache Git Services


[GitHub] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386875707
 
 
   I think the cause of this is that operator mod is using doubles to make the 
computation, while the test is forcing float32, also the modulo operator for 
floating point seems to give different results in GPU vs CPU.
   
   
https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L1511
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/mshadow_op.h#L402
   
   >>> np.double(1.68) % np.double(1.30123)
   0.378769983
   >>> np.float32(1.68) % np.float32(1.30123)
   0.37877
   
   


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


With regards,
Apache Git Services


[GitHub] larroy commented on issue #9853: Flaky test_operator.test_binary_op

2018-05-06 Thread GitBox
larroy commented on issue #9853: Flaky test_operator.test_binary_op
URL: 
https://github.com/apache/incubator-mxnet/issues/9853#issuecomment-386875707
 
 
   I think the cause of this is that operator mod is using doubles to make the 
computation, while the test is forcing float32
   
   
https://github.com/apache/incubator-mxnet/blob/master/tests/python/unittest/test_operator.py#L1511
   
https://github.com/apache/incubator-mxnet/blob/master/src/operator/mshadow_op.h#L402
   
   This discrepancy could be the cause of difference between results.
   
   >>> np.double(1.68) % np.double(1.30123)
   0.378769983
   >>> np.float32(1.68) % np.float32(1.30123)
   0.37877
   
   


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


With regards,
Apache Git Services


[GitHub] larroy commented on a change in pull request #10797: Better cleaning of git repo, signal handlers

2018-05-06 Thread GitBox
larroy commented on a change in pull request #10797: Better cleaning of git 
repo, signal handlers
URL: https://github.com/apache/incubator-mxnet/pull/10797#discussion_r186286570
 
 

 ##
 File path: ci/docker/runtime_functions.sh
 ##
 @@ -353,7 +369,18 @@ sanity_check() {
 }
 
 
+
+before_unittest() {
 
 Review comment:
   having in build.py is also fine for me


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


With regards,
Apache Git Services


[GitHub] sl1pkn07 commented on issue #10743: CUDA 9.1.xx failed if not set OLDCMAKECUDA on cmake 3.10.3 with unix makefile or Ninja generator

2018-05-06 Thread GitBox
sl1pkn07 commented on issue #10743: CUDA 9.1.xx failed if not set OLDCMAKECUDA 
on cmake 3.10.3 with unix makefile or Ninja generator
URL: 
https://github.com/apache/incubator-mxnet/issues/10743#issuecomment-386865609
 
 
   tested with cmake 3.11.1, same output
   
   seems this only works with macos / windows, but not in linux 
   
   
https://gitlab.kitware.com/cmake/cmake/commit/528e8af19f68c01c3a42af9e74801a39c16237dd
   
https://gitlab.kitware.com/cmake/cmake/blob/master/Tests/RunCMake/GeneratorToolset/RunCMakeTest.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] sl1pkn07 commented on issue #10743: CUDA 9.1.xx failed if not set OLDCMAKECUDA on cmake 3.10.3 with unix makefile or Ninja generator

2018-05-06 Thread GitBox
sl1pkn07 commented on issue #10743: CUDA 9.1.xx failed if not set OLDCMAKECUDA 
on cmake 3.10.3 with unix makefile or Ninja generator
URL: 
https://github.com/apache/incubator-mxnet/issues/10743#issuecomment-386865609
 
 
   tested with cmake 3.11.1, same output
   
   seems this only works with macos / windows, but not in linux 
   
   
https://gitlab.kitware.com/cmake/cmake/commit/528e8af19f68c01c3a42af9e74801a39c16237dd


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10822: how can load *.json and *.params with gluon api?

2018-05-06 Thread GitBox
piiswrong commented on issue #10822: how can load *.json and *.params  with 
gluon api?
URL: 
https://github.com/apache/incubator-mxnet/issues/10822#issuecomment-386858114
 
 
   use load_checkpoint, then use gluon.SymbolicBlock


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #10824: Segmentation Fault when using as_in_context

2018-05-06 Thread GitBox
piiswrong commented on issue #10824: Segmentation Fault when using as_in_context
URL: 
https://github.com/apache/incubator-mxnet/issues/10824#issuecomment-386858004
 
 
   I don't think so


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 a change in pull request #10825: Adding max_area to random_size_crop

2018-05-06 Thread GitBox
piiswrong commented on a change in pull request #10825: Adding max_area to 
random_size_crop
URL: https://github.com/apache/incubator-mxnet/pull/10825#discussion_r186279995
 
 

 ##
 File path: docs/tutorials/python/types_of_data_augmentation.md
 ##
 @@ -302,7 +302,7 @@ Some shortcut functions are provided to perform multiple 
augmentation in a singl
 ```python
 # A random crop, with a random resizing, and random aspect ratio jitter
 example_image_copy = example_image.copy()
-aug = mx.image.RandomSizedCropAug(size=(100, 100), min_area=0.1, ratio=(1.0, 
1.5))
+aug = mx.image.RandomSizedCropAug(size=(100, 100), area=0.1, ratio=(1.0, 1.5))
 
 Review comment:
   no. somehting like xx is deprecated and renamed to xxx


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


With regards,
Apache Git Services