[GitHub] indhub commented on issue #9033: Rename the section titled 'MXNet' in tutorials page to 'Low Level Interface'

2017-12-12 Thread GitBox
indhub commented on issue #9033: Rename the section titled 'MXNet' in tutorials 
page to 'Low Level Interface'
URL: https://github.com/apache/incubator-mxnet/pull/9033#issuecomment-351163010
 
 
   @larroy Website is created from 1.0.0. This needs to be fixed in 1.0.0 to 
fix the website. Please correct me if that is not true.
   


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


With regards,
Apache Git Services


[GitHub] eric-haibin-lin commented on a change in pull request #8938: Add operator for dot(dns, csr) = csr

2017-12-12 Thread GitBox
eric-haibin-lin commented on a change in pull request #8938: Add operator for 
dot(dns, csr) = csr
URL: https://github.com/apache/incubator-mxnet/pull/8938#discussion_r156471898
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -811,6 +891,94 @@ inline void DotCsrRspRspImpl(const OpContext& ctx,
   });
 }
 
+/*
+ * \brief CPU Impl of dot(dns, csr) = csr
+ */
+inline void DotDnsCsrCsrImpl(const OpContext& ctx, const cpu& cpu_dev,
+ const TBlob& lhs, const NDArray& rhs,
+ const OpReqType req, NDArray* ret) {
+  if (kNullOp == req) return;
+  CHECK_EQ(rhs.storage_type(), kCSRStorage);
+  if (!rhs.storage_initialized()) return;
+
+  using namespace mshadow;
+  using namespace mshadow::expr;
+  using nnvm::dim_t;
+
+  /*Initialize data structures*/
+  mshadow::Stream* s = ctx.get_stream();
+  const NDArray& out = *ret;
+  const TBlob data_l = lhs;
+  const TBlob data_r = rhs.data();
+  const TBlob indptr_r = rhs.aux_data(csr::kIndPtr);
+  const TBlob col_idx_r = rhs.aux_data(csr::kIdx);
+
+  MSHADOW_SGL_DBL_TYPE_SWITCH(data_r.type_flag_, DType, { // data type
+MSHADOW_IDX_TYPE_SWITCH(indptr_r.type_flag_, IType, { // indptr type
+  MSHADOW_IDX_TYPE_SWITCH(col_idx_r.type_flag_, CType, {  // colidx type
+/* Allocate workspace */
+CType num_cols_out = out.shape()[1];
+CType rhs_data_size = static_cast(col_idx_r.shape_.Size());
+size_t workspace_size = 2 * num_cols_out * sizeof(CType);
+Tensor workspace =
+ctx.requested[0].get_space_typed(
+Shape1(workspace_size), s);
+CType* col_flg = reinterpret_cast(workspace.dptr_);
+
+CType* prefix_sum = col_flg;
+CType* nnc_idx = prefix_sum + num_cols_out;
+
+/* Set the column flags for nnz columns */
+mxnet_op::Kernel::Launch(s, num_cols_out,
+  col_flg);
+mxnet_op::Kernel::Launch(
+s, rhs_data_size, col_flg, col_idx_r.dptr());
+
+/* 1. Calculate prefix sum from col flgs
+ * 2. Storage all non zero column indexes in nnc_idx
+ */
+CType cur = 0;
+prefix_sum[0] = col_flg[0];
+if (prefix_sum[0]) nnc_idx[cur++] = 0;
+for (CType i = 1; i < num_cols_out; i++) {
+  prefix_sum[i] = prefix_sum[i - 1] + col_flg[i];
+  if (prefix_sum[i] > prefix_sum[i - 1]) nnc_idx[cur++] = i;
+}
+
+/* Allocate aux data for out */
+IType num_rows_l = lhs.shape_[0];
+dim_t nnc = prefix_sum[num_cols_out - 1];
+dim_t nnz = nnc * num_rows_l;
+out.CheckAndAllocAuxData(csr::kIndPtr, Shape1(num_rows_l + 1));
+out.CheckAndAllocAuxData(csr::kIdx, Shape1(nnz));
+out.CheckAndAllocData(Shape1(nnz));
+
+/* Set csr indptr and index according to nnc_idx*/
+IType* indptr_out = out.aux_data(csr::kIndPtr).dptr();
+CType* col_idx_out = out.aux_data(csr::kIdx).dptr();
+DType* data_out = out.data().dptr();
+mxnet_op::Kernel::Launch(
+s, num_rows_l, nnc_idx, indptr_out, col_idx_out, nnc, num_rows_l);
+mxnet_op::Kernel::Launch(s, nnz, data_out);
+
+if (nnc == 0) {
 
 Review comment:
   Because you already checked `rhs.storage_initialized()` in line 922?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8938: Add operator for dot(dns, csr) = csr

2017-12-12 Thread GitBox
eric-haibin-lin commented on a change in pull request #8938: Add operator for 
dot(dns, csr) = csr
URL: https://github.com/apache/incubator-mxnet/pull/8938#discussion_r156473118
 
 

 ##
 File path: src/operator/tensor/dot-inl.h
 ##
 @@ -228,8 +231,16 @@ inline bool DotForwardInferStorageType(const 
nnvm::NodeAttrs& attrs,
   if (!dispatched && lhs_stype == kCSRStorage && rhs_rsp_or_dns &&
   !param.transpose_a && !param.transpose_b) {
 // csr, rsp/dns -> dns
-dispatched = storage_type_assign(_stype, kDefaultStorage,
- dispatch_mode, DispatchMode::kFComputeEx);
+dispatched = storage_type_assign(_stype, kDefaultStorage, 
dispatch_mode,
+ DispatchMode::kFComputeEx);
+  }
+  if (!dispatched && lhs_stype == kDefaultStorage && rhs_stype == kCSRStorage 
&&
+  !param.transpose_a && !param.transpose_b) {
+// dns, csr -> csr
+if (dev_mask == mshadow::cpu::kDevMask) {
+  dispatched = storage_type_assign(_stype, kCSRStorage, dispatch_mode,
+   DispatchMode::kFComputeEx);
 
 Review comment:
   Is output stype consistent on cpu and gpu? The output stype should be 
consistent to avoid confusion to users (see 
https://github.com/apache/incubator-mxnet/blob/d2a856a3a2abb4e72edc301b8b821f0b75f30722/src/operator/tensor/matrix_op-inl.h#L400-L418)
 
   The only difference is that on GPU, it performs fallback. If the output 
stype infers sparse, then it first produce dense output, then cast it to 
sparse. The fallback is handled in executor already


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


With regards,
Apache Git Services


[GitHub] leleamol commented on issue #8957: Adding the steps to build MXNet with NCCL

2017-12-12 Thread GitBox
leleamol commented on issue #8957: Adding the steps to build MXNet with NCCL
URL: https://github.com/apache/incubator-mxnet/pull/8957#issuecomment-351174177
 
 
   @ptrendx 
   I have added the "Passed" statement in the test_nccl.py


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9033: Rename the section titled 'MXNet' in tutorials page to 'Low Level Interface'

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9033: Rename the section titled 
'MXNet' in tutorials page to 'Low Level Interface'
URL: https://github.com/apache/incubator-mxnet/pull/9033#discussion_r156483296
 
 

 ##
 File path: docs/tutorials/index.md
 ##
 @@ -27,9 +27,9 @@ This is a selected subset of Gluon tutorials that explains 
basic usage of Gluon
 - [Fast, portable neural networks with Gluon 
HybridBlocks](http://gluon.mxnet.io/chapter07_distributed-learning/hybridize.html)
 - [Training on multiple GPUs with 
gluon](http://gluon.mxnet.io/chapter07_distributed-learning/multiple-gpus-gluon.html)
 
-## MXNet
+## Low Level Interface
 
 Review comment:
   Thinking further this page may be better organized overall. For instance 
before beginning with gluon, we can have an introductory para about high level 
interface (gluon) and the low level interface (symbolic). And explicitly call 
out that gluon is now the preferred way to way to use MXNet. Once that is 
established the further sections may get more obvious while improving the flow 
of the page. Adding @aaronmarkham for any further comments.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
larroy commented on issue #9035: [WIP] Build improvements, for users and for 
Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#issuecomment-351130522
 
 
   I actually was thinking of having a build.json file with all the flags that 
can be easily modified.


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


With regards,
Apache Git Services


[GitHub] jerrin92 commented on issue #8874: mxnet installation from source: C++ linkage error on HPC

2017-12-12 Thread GitBox
jerrin92 commented on issue #8874: mxnet installation from source: C++ linkage 
error on HPC
URL: 
https://github.com/apache/incubator-mxnet/issues/8874#issuecomment-351112576
 
 
   Copied below is the config.mk
   
   
`#---
   #  Template configuration for compiling mxnet
   #
   #  If you want to change the configuration, please use the following
   #  steps. Assume you are on the root directory of mxnet. First copy the this
   #  file so that any local changes will be ignored by git
   #
   #  $ cp make/config.mk .
   #
   #  Next modify the according entries, and then compile by
   #
   #  $ make
   #
   #  or build in parallel with 8 threads
   #
   #  $ make -j8
   
#---
   
   #-
   # choice of compiler
   #
   
   export CC = gcc
   export CXX = g++
   export NVCC = nvcc
   
   # whether compile with options for MXNet developer
   DEV = 0
   
   # whether compile with debug
   DEBUG = 0
   
   # whether compiler with profiler
   USE_PROFILER =
   
   # the additional link flags you want to add
   ADD_LDFLAGS =
   
   # the additional compile flags you want to add
   ADD_CFLAGS =
   
   #-
   # matrix computation libraries for CPU/GPU
   #-
   
   # whether use CUDA during compile
   USE_CUDA = 0
   
   # add the path to CUDA library to link and compile flag
   # if you have already add them to environment variable, leave it as NONE
   # USE_CUDA_PATH = /usr/local/cuda
   USE_CUDA_PATH = NONE
   
   # whether use CuDNN R3 library
   USE_CUDNN = 0
   
   # whether use cuda runtime compiling for writing kernels in native language 
(i.e. Python)
   USE_NVRTC = 0
   
   # whether use opencv during compilation
   # you can disable it, however, you will not able to use
   # imbin iterator
   USE_OPENCV = 1
   
   # use openmp for parallelization
   USE_OPENMP = 1
   
   # MKL ML Library for Intel CPU/Xeon Phi
   # Please refer to MKL_README.md for details
   
   # MKL ML Library folder, need to be root for /usr/local
   # Change to User Home directory for standard user
   # For USE_BLAS!=mkl only
   MKLML_ROOT=/usr/local
   
   # whether use MKL2017 library
   USE_MKL2017 = 0
   
   # whether use MKL2017 experimental feature for high performance
   # Prerequisite USE_MKL2017=1
   USE_MKL2017_EXPERIMENTAL = 0
   
   # whether use NNPACK library
   USE_NNPACK = 0
   
   # choose the version of blas you want to use
   # can be: mkl, blas, atlas, openblas
   # in default use atlas for linux while apple for osx
   UNAME_S := $(shell uname -s)
   ifeq ($(UNAME_S), Darwin)
   USE_BLAS = apple
   else
   USE_BLAS = atlas
   endif
   
   # whether use lapack during compilation
   # only effective when compiled with blas versions openblas/apple/atlas/mkl
   USE_LAPACK = 1
   
   # path to lapack library in case of a non-standard installation
   USE_LAPACK_PATH =
   
   # add path to intel library, you may need it for MKL, if you did not add the 
path
   # to environment variable
   USE_INTEL_PATH = NONE
   
   # If use MKL only for BLAS, choose static link automatically to allow python 
wrapper
   ifeq ($(USE_MKL2017), 0)
   ifeq ($(USE_BLAS), mkl)
   USE_STATIC_MKL = 1
   endif
   else
   USE_STATIC_MKL = NONE
   endif
   
   #
   # Settings for power and arm arch
   #
   ARCH := $(shell uname -a)
   ifneq (,$(filter $(ARCH), armv6l armv7l powerpc64le ppc64le aarch64))
USE_SSE=0
   else
USE_SSE=1
   endif
   
   #
   # distributed computing
   #
   
   # whether or not to enable multi-machine supporting
   USE_DIST_KVSTORE = 0
   
   # whether or not allow to read and write HDFS directly. If yes, then hadoop 
is
   # required
   USE_HDFS = 0
   
   # path to libjvm.so. required if USE_HDFS=1
   LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
   
   # whether or not allow to read and write AWS S3 directly. If yes, then
   # libcurl4-openssl-dev is required, it can be installed on Ubuntu by
   # sudo apt-get install -y libcurl4-openssl-dev
   USE_S3 = 0
   
   #
   # additional operators
   #
   
   # path to folders containing projects specific operators that you don't want 
to put in src/operators
   EXTRA_OPERATORS =
   
   #
   # other features
   #
   
   # Create C++ interface package
   USE_CPP_PACKAGE = 0
   
   #
   # plugins
   #
   
   # whether to use caffe integration. This requires installing caffe.
   # You also need to add CAFFE_PATH/build/lib to your LD_LIBRARY_PATH
   # CAFFE_PATH = $(HOME)/caffe
   # MXNET_PLUGINS += 

[GitHub] jerrin92 commented on issue #8874: mxnet installation from source: C++ linkage error on HPC

2017-12-12 Thread GitBox
jerrin92 commented on issue #8874: mxnet installation from source: C++ linkage 
error on HPC
URL: 
https://github.com/apache/incubator-mxnet/issues/8874#issuecomment-351112576
 
 
   ```
   Copied below is the config.mk
   
   
#---
   #  Template configuration for compiling mxnet
   #
   #  If you want to change the configuration, please use the following
   #  steps. Assume you are on the root directory of mxnet. First copy the this
   #  file so that any local changes will be ignored by git
   #
   #  $ cp make/config.mk .
   #
   #  Next modify the according entries, and then compile by
   #
   #  $ make
   #
   #  or build in parallel with 8 threads
   #
   #  $ make -j8
   
#---
   
   #-
   # choice of compiler
   #
   
   export CC = gcc
   export CXX = g++
   export NVCC = nvcc
   
   # whether compile with options for MXNet developer
   DEV = 0
   
   # whether compile with debug
   DEBUG = 0
   
   # whether compiler with profiler
   USE_PROFILER =
   
   # the additional link flags you want to add
   ADD_LDFLAGS =
   
   # the additional compile flags you want to add
   ADD_CFLAGS =
   
   #-
   # matrix computation libraries for CPU/GPU
   #-
   
   # whether use CUDA during compile
   USE_CUDA = 0
   
   # add the path to CUDA library to link and compile flag
   # if you have already add them to environment variable, leave it as NONE
   # USE_CUDA_PATH = /usr/local/cuda
   USE_CUDA_PATH = NONE
   
   # whether use CuDNN R3 library
   USE_CUDNN = 0
   
   # whether use cuda runtime compiling for writing kernels in native language 
(i.e. Python)
   USE_NVRTC = 0
   
   # whether use opencv during compilation
   # you can disable it, however, you will not able to use
   # imbin iterator
   USE_OPENCV = 1
   
   # use openmp for parallelization
   USE_OPENMP = 1
   
   # MKL ML Library for Intel CPU/Xeon Phi
   # Please refer to MKL_README.md for details
   
   # MKL ML Library folder, need to be root for /usr/local
   # Change to User Home directory for standard user
   # For USE_BLAS!=mkl only
   MKLML_ROOT=/usr/local
   
   # whether use MKL2017 library
   USE_MKL2017 = 0
   
   # whether use MKL2017 experimental feature for high performance
   # Prerequisite USE_MKL2017=1
   USE_MKL2017_EXPERIMENTAL = 0
   
   # whether use NNPACK library
   USE_NNPACK = 0
   
   # choose the version of blas you want to use
   # can be: mkl, blas, atlas, openblas
   # in default use atlas for linux while apple for osx
   UNAME_S := $(shell uname -s)
   ifeq ($(UNAME_S), Darwin)
   USE_BLAS = apple
   else
   USE_BLAS = atlas
   endif
   
   # whether use lapack during compilation
   # only effective when compiled with blas versions openblas/apple/atlas/mkl
   USE_LAPACK = 1
   
   # path to lapack library in case of a non-standard installation
   USE_LAPACK_PATH =
   
   # add path to intel library, you may need it for MKL, if you did not add the 
path
   # to environment variable
   USE_INTEL_PATH = NONE
   
   # If use MKL only for BLAS, choose static link automatically to allow python 
wrapper
   ifeq ($(USE_MKL2017), 0)
   ifeq ($(USE_BLAS), mkl)
   USE_STATIC_MKL = 1
   endif
   else
   USE_STATIC_MKL = NONE
   endif
   
   #
   # Settings for power and arm arch
   #
   ARCH := $(shell uname -a)
   ifneq (,$(filter $(ARCH), armv6l armv7l powerpc64le ppc64le aarch64))
USE_SSE=0
   else
USE_SSE=1
   endif
   
   #
   # distributed computing
   #
   
   # whether or not to enable multi-machine supporting
   USE_DIST_KVSTORE = 0
   
   # whether or not allow to read and write HDFS directly. If yes, then hadoop 
is
   # required
   USE_HDFS = 0
   
   # path to libjvm.so. required if USE_HDFS=1
   LIBJVM=$(JAVA_HOME)/jre/lib/amd64/server
   
   # whether or not allow to read and write AWS S3 directly. If yes, then
   # libcurl4-openssl-dev is required, it can be installed on Ubuntu by
   # sudo apt-get install -y libcurl4-openssl-dev
   USE_S3 = 0
   
   #
   # additional operators
   #
   
   # path to folders containing projects specific operators that you don't want 
to put in src/operators
   EXTRA_OPERATORS =
   
   #
   # other features
   #
   
   # Create C++ interface package
   USE_CPP_PACKAGE = 0
   
   #
   # plugins
   #
   
   # whether to use caffe integration. This requires installing caffe.
   # You also need to add CAFFE_PATH/build/lib to your LD_LIBRARY_PATH
   # CAFFE_PATH = $(HOME)/caffe
   # MXNET_PLUGINS += 

[GitHub] marcoabreu commented on issue #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
marcoabreu commented on issue #9035: [WIP] Build improvements, for users and 
for Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#issuecomment-351122282
 
 
   I would like to keep the parameters in the jenkinsfile. Please make it 
possible that they can be passed into your python script.
   I'll make a detailed review 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] larroy commented on issue #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
larroy commented on issue #9035: [WIP] Build improvements, for users and for 
Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#issuecomment-351128643
 
 
   Why do you want to keep the parameters in the Jenkinsfile?  From what I have 
seen in the past from great test engineers it that they keep the config in 
jenkins to a minimum and directly call a script.  I don't like all kinds of 
flags and config in the Jenkins configuration, for starters because it's harder 
to reproduce when you build in the platform by yourself to fix issues. (As a 
developer I don't want to specify all these flags when building).


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8919: [Vision] add test cases for flip, normalize, to_tensor

2017-12-12 Thread GitBox
marcoabreu commented on issue #8919: [Vision] add test cases for flip, 
normalize, to_tensor
URL: https://github.com/apache/incubator-mxnet/pull/8919#issuecomment-351151366
 
 
   Hello @javelinjs, please rebase your 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] ZiyueHuang commented on a change in pull request #9025: fix small memory leak of sparse embedding

2017-12-12 Thread GitBox
ZiyueHuang commented on a change in pull request #9025: fix small memory leak 
of sparse embedding
URL: https://github.com/apache/incubator-mxnet/pull/9025#discussion_r156447279
 
 

 ##
 File path: src/operator/tensor/indexing_op.cu
 ##
 @@ -91,6 +91,7 @@ void 
SparseEmbeddingOpForwardRspImpl(mshadow::Stream* s,
 Kernel::Launch(s, data_size, is_valid_ptr, data_ptr, 
min, max);
 CUDA_CALL(cudaMemcpy(_valid, is_valid_ptr, sizeof(int32_t),
   cudaMemcpyDeviceToHost));
+CUDA_CALL(cudaFree(is_valid_ptr));
 
 Review comment:
   Sure. Changed.


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


With regards,
Apache Git Services


[GitHub] javelinjs commented on issue #8919: [Vision] add test cases for flip, normalize, to_tensor

2017-12-12 Thread GitBox
javelinjs commented on issue #8919: [Vision] add test cases for flip, 
normalize, to_tensor
URL: https://github.com/apache/incubator-mxnet/pull/8919#issuecomment-351152519
 
 
   @marcoabreu You mean rebase from master? Is there anything related to these 
operators?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 opened a new pull request #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
larroy opened a new pull request #9035: [WIP] Build improvements, for users and 
for Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035
 
 
   ## Description ##
   Provide an easy to use build.py script to aglutinate coplex build logic 
which works on multiple platforms and does a build process plus artifacts that 
can be easily used.
   
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [ ] 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


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9016: Add googletest as a 3rdparty library

2017-12-12 Thread GitBox
larroy commented on issue #9016: Add googletest as a 3rdparty library
URL: https://github.com/apache/incubator-mxnet/pull/9016#issuecomment-351118175
 
 
   @cjolivier01  right, it was voted and passed in the list, didn't you see?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
larroy commented on issue #9035: [WIP] Build improvements, for users and for 
Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#issuecomment-351120512
 
 
   @marcoabreu 
   @mbaijal 
   @KellenSunderland 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8872: Minor refactor: prevent string copying, list -> vector, shared_ptr by?

2017-12-12 Thread GitBox
larroy commented on issue #8872: Minor refactor: prevent string copying, list 
-> vector, shared_ptr by?
URL: https://github.com/apache/incubator-mxnet/pull/8872#issuecomment-351120257
 
 
   @piiswrong please merge?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9001: Disable test_optimizers:test_sgd (Temp fix #9000)

2017-12-12 Thread GitBox
rahul003 commented on issue #9001: Disable test_optimizers:test_sgd (Temp fix 
#9000)
URL: https://github.com/apache/incubator-mxnet/pull/9001#issuecomment-351143893
 
 
   Please consider merging. I'm running into this test failure for 3 of my PRs


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8919: [Vision] add test cases for flip, normalize, to_tensor

2017-12-12 Thread GitBox
marcoabreu commented on issue #8919: [Vision] add test cases for flip, 
normalize, to_tensor
URL: https://github.com/apache/incubator-mxnet/pull/8919#issuecomment-351153571
 
 
   Ah my bad, I didn't see you're merging into a different branch. Nevermind :)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above 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: Remove defunct NLP tutorial page (#9045)

2017-12-12 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 6d1f07d  Remove defunct NLP tutorial page (#9045)
6d1f07d is described below

commit 6d1f07dcf1a33872ac15b032167584e98a183cc8
Author: Simon <11811097+simoncorstonoli...@users.noreply.github.com>
AuthorDate: Tue Dec 12 19:14:40 2017 -0800

Remove defunct NLP tutorial page (#9045)

* Update for MXNet 1.0. PEP8 fixes to code and misc improvements. Tested 
under Python 2.7 and Python 3.6 on Sagemaker.

* Remove defunct tutorial page
---
 docs/tutorials/nlp/rnn.md | 14 --
 1 file changed, 14 deletions(-)

diff --git a/docs/tutorials/nlp/rnn.md b/docs/tutorials/nlp/rnn.md
deleted file mode 100644
index e2d2265..000
--- a/docs/tutorials/nlp/rnn.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Recurrent Neural Networks
-This folder contains RNN examples using a low-level symbol interface. You can 
get the source code for this example on 
[GitHub](https://github.com/dmlc/mxnet/tree/master/example/rnn).
-
-## Python
-
-- 
[https://github.com/dmlc/mxnet/blob/master/example/rnn/lstm_bucketing.py](lstm_bucketing.py).
 A PennTreeBank language model using LSTM
-- 
[https://github.com/dmlc/mxnet/blob/master/example/rnn/cudnn_lstm_bucketing.py](cudnn_lstm_bucketing.py).
 A PennTreeBank language model using LSTM and CUDNN
-
-Performance Note:
-
-Using more ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For 
information on setting ```MXNET_GPU_WORKER_NTHREADS```, refer to [Environment 
Variables](http://mxnet.io/how_to/env_var.html).
-
-## Next Steps
-* [MXNet tutorials index](http://mxnet.io/tutorials/index.html)

-- 
To stop receiving notification emails like this one, please contact
['"comm...@mxnet.apache.org" '].


[GitHub] piiswrong closed pull request #9045: Remove defunct NLP tutorial page

2017-12-12 Thread GitBox
piiswrong closed pull request #9045: Remove defunct NLP tutorial page
URL: https://github.com/apache/incubator-mxnet/pull/9045
 
 
   

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/docs/tutorials/nlp/rnn.md b/docs/tutorials/nlp/rnn.md
deleted file mode 100644
index e2d2265ece..00
--- a/docs/tutorials/nlp/rnn.md
+++ /dev/null
@@ -1,14 +0,0 @@
-# Recurrent Neural Networks
-This folder contains RNN examples using a low-level symbol interface. You can 
get the source code for this example on 
[GitHub](https://github.com/dmlc/mxnet/tree/master/example/rnn).
-
-## Python
-
-- 
[https://github.com/dmlc/mxnet/blob/master/example/rnn/lstm_bucketing.py](lstm_bucketing.py).
 A PennTreeBank language model using LSTM
-- 
[https://github.com/dmlc/mxnet/blob/master/example/rnn/cudnn_lstm_bucketing.py](cudnn_lstm_bucketing.py).
 A PennTreeBank language model using LSTM and CUDNN
-
-Performance Note:
-
-Using more ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For 
information on setting ```MXNET_GPU_WORKER_NTHREADS```, refer to [Environment 
Variables](http://mxnet.io/how_to/env_var.html).
-
-## Next Steps
-* [MXNet tutorials index](http://mxnet.io/tutorials/index.html)


 


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


With regards,
Apache Git Services


[GitHub] huabinhuang1994 commented on issue #9031: cuda error:Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading CUDA: unknown error

2017-12-12 Thread GitBox
huabinhuang1994 commented on issue #9031:  cuda error:Check failed: e == 
cudaSuccess || e == cudaErrorCudartUnloading CUDA: unknown error
URL: 
https://github.com/apache/incubator-mxnet/issues/9031#issuecomment-351269912
 
 
   I found that it's because my nvidia driver is broken ,I re-installed it and 
solve the problem


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


With regards,
Apache Git Services


[GitHub] huabinhuang1994 closed issue #9031: cuda error:Check failed: e == cudaSuccess || e == cudaErrorCudartUnloading CUDA: unknown error

2017-12-12 Thread GitBox
huabinhuang1994 closed issue #9031:  cuda error:Check failed: e == cudaSuccess 
|| e == cudaErrorCudartUnloading CUDA: unknown error
URL: https://github.com/apache/incubator-mxnet/issues/9031
 
 
   


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


With regards,
Apache Git Services


[GitHub] leezu commented on issue #8280: v0.12 autograd regression

2017-12-12 Thread GitBox
leezu commented on issue #8280: v0.12 autograd regression
URL: 
https://github.com/apache/incubator-mxnet/issues/8280#issuecomment-351269852
 
 
   The issue seems to be fixed in v1. Perhaps by #8701? Anyways, 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] piiswrong closed pull request #9001: Disable test_optimizers:test_sgd (Temp fix #9000)

2017-12-12 Thread GitBox
piiswrong closed pull request #9001: Disable test_optimizers:test_sgd (Temp fix 
#9000)
URL: https://github.com/apache/incubator-mxnet/pull/9001
 
 
   

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/tests/python/unittest/test_optimizer.py 
b/tests/python/unittest/test_optimizer.py
index 1a26434015..ec4fbfd59a 100644
--- a/tests/python/unittest/test_optimizer.py
+++ b/tests/python/unittest/test_optimizer.py
@@ -198,6 +198,7 @@ def update(self, index, weight, grad, state):
 def update_multi_precision(self, index, weight, grad, state):
 self.update(index, weight, grad, state)
 
+@unittest.skip("Test fails intermittently. Temporarily disabled until fixed. 
Tracked at https://github.com/apache/incubator-mxnet/issues/9000;)
 def test_sgd():
 mx.random.seed(0)
 opt1 = PySGD


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above 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: Disable test_optimizers:test_sgd (Temp fix #9000) (#9001)

2017-12-12 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 9e2bdeb  Disable test_optimizers:test_sgd (Temp fix #9000) (#9001)
9e2bdeb is described below

commit 9e2bdeba74ab829026913488a2df0eb8c70fd703
Author: Marco de Abreu 
AuthorDate: Wed Dec 13 04:27:05 2017 +0100

Disable test_optimizers:test_sgd (Temp fix #9000) (#9001)

* Disable test_optimizers:test_sgd

* Fix newline
---
 tests/python/unittest/test_optimizer.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/python/unittest/test_optimizer.py 
b/tests/python/unittest/test_optimizer.py
index 1a26434..ec4fbfd 100644
--- a/tests/python/unittest/test_optimizer.py
+++ b/tests/python/unittest/test_optimizer.py
@@ -198,6 +198,7 @@ class PySGD(mx.optimizer.Optimizer):
 def update_multi_precision(self, index, weight, grad, state):
 self.update(index, weight, grad, state)
 
+@unittest.skip("Test fails intermittently. Temporarily disabled until fixed. 
Tracked at https://github.com/apache/incubator-mxnet/issues/9000;)
 def test_sgd():
 mx.random.seed(0)
 opt1 = PySGD

-- 
To stop receiving notification emails like this one, please contact
['"comm...@mxnet.apache.org" '].


[GitHub] piiswrong closed issue #9000: Flaky test OOM: test_optimizers:test_sgd

2017-12-12 Thread GitBox
piiswrong closed issue #9000: Flaky test OOM: test_optimizers:test_sgd
URL: https://github.com/apache/incubator-mxnet/issues/9000
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8972: Profiling enhancements, python API, vtune and chrome tracing objects, etc.

2017-12-12 Thread GitBox
piiswrong commented on issue #8972: Profiling enhancements, python API, vtune 
and chrome tracing objects, etc.
URL: https://github.com/apache/incubator-mxnet/pull/8972#issuecomment-351272867
 
 
   Can you use a dmlc::Parameter for profiler config parsing? Similar to how 
operator parameters are parsed.
   The python frontend would accept keyword arguments. Then you don't need to 
have awkward mode names like symbolic_api


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


With regards,
Apache Git Services


[GitHub] sandeep-krishnamurthy commented on issue #9030: Fix Gan

2017-12-12 Thread GitBox
sandeep-krishnamurthy commented on issue #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#issuecomment-351167375
 
 
   @indhub 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9037: Coverity fixes

2017-12-12 Thread GitBox
rahul003 opened a new pull request #9037: Coverity fixes
URL: https://github.com/apache/incubator-mxnet/pull/9037
 
 
   ## Description ##
   Fixing errors identified by static analysis tool Coverity.
   
   - Fixes memory leaks
   - Sets value to uninitialized variable
   - Adds a default case to a switch statement
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage
   - [x] For user-facing API changes, API doc string has been updated. For new 
C++ functions in header files, their functionalities and arguments are 
well-documented. 
   - [x] To my best knowledge, examples are either not affected by this change, 
or have been fixed to be compatible with this change
   
   ### Changes ###
   - [x] Fixes memory leaks
   - [x] Sets value to uninitialized variable
   - [x] Adds a default case to a switch statement
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9033: Rename the section titled 'MXNet' in tutorials page to 'Low Level Interface'

2017-12-12 Thread GitBox
larroy commented on issue #9033: Rename the section titled 'MXNet' in tutorials 
page to 'Low Level Interface'
URL: https://github.com/apache/incubator-mxnet/pull/9033#issuecomment-351176655
 
 
   Then you need to fix the jenkinsfile, a hyphen is missing, check diff 
against master.


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


With regards,
Apache Git Services


[GitHub] szha commented on issue #9048: pip package relies on outdated libgfortran.so version

2017-12-12 Thread GitBox
szha commented on issue #9048: pip package relies on outdated libgfortran.so 
version
URL: 
https://github.com/apache/incubator-mxnet/issues/9048#issuecomment-351277879
 
 
   I'm evaluating ways to allow pip users to benefit from the change as well 
without static-linking.


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

2017-12-12 Thread GitBox
szha commented on issue #8671: Discussion and troubleshooting on PyPI (pip) 
installation
URL: 
https://github.com/apache/incubator-mxnet/issues/8671#issuecomment-351283896
 
 
   #9048 


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


With regards,
Apache Git Services


[GitHub] nihilityworld opened a new issue #9051: [Android,v0.11.0] The result of mxnet_predict is wrong! AND how to compile the amalgamation in Android Studio?

2017-12-12 Thread GitBox
nihilityworld opened a new issue #9051: [Android,v0.11.0] The result of 
mxnet_predict is wrong! AND how to compile the amalgamation in Android Studio?
URL: https://github.com/apache/incubator-mxnet/issues/9051
 
 
   @piiswrong I have compile the amalgamation in IOS and ANDROID. The params 
and the json file is same. The result in IOS is right, while it in ANDROID is 
wrong. I got the same result array with different image. Why I got this fault?
   
   I tried to compile mxnet_predict-all.cc in Android Studio which can debug 
the code, but I failed.
   Can anyone give a tutorial of compiling the amalgamation in Android Studio 
with cmake or tell me how to debug 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] nihilityworld closed issue #8525: how to make the IOS library?

2017-12-12 Thread GitBox
nihilityworld closed issue #8525: how to make the IOS library?
URL: https://github.com/apache/incubator-mxnet/issues/8525
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9048: pip package relies on outdated libgfortran.so version

2017-12-12 Thread GitBox
piiswrong commented on issue #9048: pip package relies on outdated 
libgfortran.so version
URL: 
https://github.com/apache/incubator-mxnet/issues/9048#issuecomment-351277646
 
 
   @szha Can we do a conda build?


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


With regards,
Apache Git Services


[GitHub] iblis17 opened a new issue #9050: got segfault from lenet with stn example

2017-12-12 Thread GitBox
iblis17 opened a new issue #9050: got segfault from lenet with stn example
URL: https://github.com/apache/incubator-mxnet/issues/9050
 
 
   Hi,
   We encounter segfault with stn.
   Here is the original issue
   https://github.com/dmlc/MXNet.jl/issues/369.
   
   TL;DR:
   Segfault happened in CPU-version `mshadow::BilinearSamplingBackward`
   
   gdb trace here:
   ```julia
   Thread 37 "julia" received signal SIGSEGV, Segmentation fault.
   [Switching to Thread 0x7fff35a15700 (LWP 13819)]
   0x7fff83e77ba0 in mshadow::BilinearSamplingBackward 
(input_grad=..., grid_src_data=..., output_grad=..., 
   input_data=...) at src/operator/spatial_transformer.cc:120
   120   *(g_input + data_index + 1) += *(grad + grad_index) * 
top_left_y_w
   (gdb) bt
   #0  0x7fff83e77ba0 in mshadow::BilinearSamplingBackward 
(input_grad=..., grid_src_data=..., output_grad=..., 
   input_data=...) at src/operator/spatial_transformer.cc:120
   #1  0x7fff83e5f18c in mxnet::op::SpatialTransformerOp::Backward (this=0x38bcd30, ctx=..., 
   out_grad=std::vector of length 1, capacity 1 = {...}, 
in_data=std::vector of length 2, capacity 2 = {...}, 
   out_data=std::vector of length 3, capacity 3 = {...}, req=std::vector of 
length 2, capacity 2 = {...}, 
   in_grad=std::vector of length 2, capacity 2 = {...}, 
aux_args=std::vector of length 0, capacity 0)
   at src/operator/./spatial_transformer-inl.h:136
   (gdb) p grad
   $1 = (const float *) 0x7fff251e6f90
   (gdb) p top_left_y_w
   $2 = 0.376614928
   (gdb) p grad_index
   $3 = 0
   (gdb) p *(grad + grad_index) 
 
   $4 = 0.00177509966
   (gdb) p g_input + data_index + 1
   $5 = (float *) 0x80032442cf50
   (gdb) p g_input
   $6 = (float *) 0x7fff2442cf50
   (gdb) p data_index
   $7 = 4294967295
   ```
   actually `data_index` become a negative number.
   
   Also, segfault can reproduce in Python's example (with 1.0 prebuilt binary) 
(https://github.com/dmlc/MXNet.jl/issues/369#issuecomment-350617043)
   ```
   ./train_mnist.py --network lenet --add_stn --optimizer adam
   ```


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9027: Usability improvement for cnn_chinese_text_classification

2017-12-12 Thread GitBox
eric-haibin-lin commented on issue #9027: Usability improvement for 
cnn_chinese_text_classification
URL: https://github.com/apache/incubator-mxnet/pull/9027#issuecomment-351285677
 
 
   Also removed the deprecated code example.


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


With regards,
Apache Git Services


[GitHub] dwSun commented on issue #8894: Mobilenet

2017-12-12 Thread GitBox
dwSun commented on issue #8894: Mobilenet
URL: https://github.com/apache/incubator-mxnet/pull/8894#issuecomment-351293248
 
 
   With alpha=1, this change is fully compatible with previously trained model.
   
   The symbol loaded by mx.model.load_checkpoint is slightly different with the 
one return by mobilenet.get_symbol. The global_pool kernel size is calculated 
depending on resolution in 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


[incubator-mxnet] branch master updated: Add cscope filenames to gitignore (#9019)

2017-12-12 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 73fa65f  Add cscope filenames to gitignore (#9019)
73fa65f is described below

commit 73fa65febfd3e8040ce54136551474bcfc92375a
Author: Anirudh Subramanian 
AuthorDate: Tue Dec 12 22:32:00 2017 -0800

Add cscope filenames to gitignore (#9019)

* Add cscope filenames to gitignore

* Add cscope.files instead of dir
---
 .gitignore | 4 
 1 file changed, 4 insertions(+)

diff --git a/.gitignore b/.gitignore
index fbd62c9..9d2e894 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,6 +100,10 @@ input.txt*
 # ctags
 tags
 
+# cscope
+cscope.out
+cscope.files
+
 # Scala package
 *.class
 scala-package/*/target/

-- 
To stop receiving notification emails like this one, please contact
['"comm...@mxnet.apache.org" '].


[GitHub] piiswrong closed pull request #9019: Add cscope filenames to gitignore

2017-12-12 Thread GitBox
piiswrong closed pull request #9019: Add cscope filenames to gitignore
URL: https://github.com/apache/incubator-mxnet/pull/9019
 
 
   

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/.gitignore b/.gitignore
index fbd62c9ec5..9d2e8944f4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -100,6 +100,10 @@ input.txt*
 # ctags
 tags
 
+# cscope
+cscope.out
+cscope.files
+
 # Scala package
 *.class
 scala-package/*/target/


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above 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: Update for MXNet 1.0. PEP8 fixes to code and misc improvements. Tested under Python 2.7 and Python 3.6 on Sagemaker. (#9036)

2017-12-12 Thread zhasheng
This is an automated email from the ASF dual-hosted git repository.

zhasheng 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 5284513  Update for MXNet 1.0. PEP8 fixes to code and misc 
improvements. Tested under Python 2.7 and Python 3.6 on Sagemaker. (#9036)
5284513 is described below

commit 52845131e868c15f2bc0a9396f3392ae46c899bc
Author: Simon <11811097+simoncorstonoli...@users.noreply.github.com>
AuthorDate: Tue Dec 12 12:24:47 2017 -0800

Update for MXNet 1.0. PEP8 fixes to code and misc improvements. Tested 
under Python 2.7 and Python 3.6 on Sagemaker. (#9036)
---
 docs/tutorials/nlp/cnn.md | 162 +++---
 1 file changed, 97 insertions(+), 65 deletions(-)

diff --git a/docs/tutorials/nlp/cnn.md b/docs/tutorials/nlp/cnn.md
index 23f74c4..7f56b76 100644
--- a/docs/tutorials/nlp/cnn.md
+++ b/docs/tutorials/nlp/cnn.md
@@ -1,6 +1,6 @@
 # Text Classification Using a Convolutional Neural Network on MXNet
 
-This tutorial is based of Yoon Kim's [paper](https://arxiv.org/abs/1408.5882) 
on using convolutional neural networks for sentence sentiment classification.
+This tutorial is based of Yoon Kim's [paper](https://arxiv.org/abs/1408.5882) 
on using convolutional neural networks for sentence sentiment classification. 
The tutorial has been tested on MXNet 1.0 running under Python 2.7 and Python 
3.6.
 
 For this tutorial, we will train a convolutional deep network model on movie 
review sentences from Rotten Tomatoes labeled with their sentiment. The result 
will be a model that can classify a sentence based on its sentiment (with 1 
being a purely positive sentiment, 0 being a purely negative sentiment and 0.5 
being neutral).
 
@@ -8,16 +8,24 @@ Our first step will be to fetch the labeled training data of 
positive and negati
 
 
 ```python
-import urllib2
+from __future__ import print_function
+
+from collections import Counter
+import itertools
 import numpy as np
 import re
-import itertools
-from collections import Counter
 
+try:
+# For Python 3.0 and later
+from urllib.request import urlopen
+except ImportError:
+# Fall back to Python 2's urllib2
+from urllib2 import urlopen
+
 def clean_str(string):
 """
-Tokenization/string cleaning for all datasets except for SST.
-Original taken from 
https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
+Tokenization/string cleaning.
+Original from 
https://github.com/yoonkim/CNN_sentence/blob/master/process_data.py
 """
 string = re.sub(r"[^A-Za-z0-9(),!?\'\`]", " ", string)
 string = re.sub(r"\'s", " \'s", string)
@@ -32,38 +40,42 @@ def clean_str(string):
 string = re.sub(r"\)", " \) ", string)
 string = re.sub(r"\?", " \? ", string)
 string = re.sub(r"\s{2,}", " ", string)
+
 return string.strip().lower()
 
+def download_sentences(url):
+"""
+Download sentences from specified URL. 
+
+Strip trailing newline, convert to Unicode.
+"""
+
+remote_file = urlopen(url)
+return [line.decode('Latin1').strip() for line in remote_file.readlines()]
+
 def load_data_and_labels():
 """
-Loads MR polarity data from files, splits the data into words and 
generates labels.
+Loads polarity data from files, splits the data into words and generates 
labels.
 Returns split sentences and labels.
 """
-# Pull sentences with positive sentiment
-pos_file = 
urllib2.urlopen('https://raw.githubusercontent.com/yoonkim/CNN_sentence/master/rt-polarity.pos')
-
-# Pull sentences with negative sentiment
-neg_file = 
urllib2.urlopen('https://raw.githubusercontent.com/yoonkim/CNN_sentence/master/rt-polarity.neg')
-
-# Load data from files
-positive_examples = list(pos_file.readlines())
-positive_examples = [s.strip() for s in positive_examples]
-negative_examples = list(neg_file.readlines())
-negative_examples = [s.strip() for s in negative_examples]
-# Split by words
+
+positive_examples = 
download_sentences('https://raw.githubusercontent.com/yoonkim/CNN_sentence/master/rt-polarity.pos')
+negative_examples = 
download_sentences('https://raw.githubusercontent.com/yoonkim/CNN_sentence/master/rt-polarity.neg')
+
+# Tokenize
 x_text = positive_examples + negative_examples
-x_text = [clean_str(sent) for sent in x_text]
-x_text = [s.split(" ") for s in x_text]
+x_text = [clean_str(sent).split(" ") for sent in x_text]
+
 # Generate labels
 positive_labels = [1 for _ in positive_examples]
 negative_labels = [0 for _ in negative_examples]
 y = np.concatenate([positive_labels, negative_labels], 0)
-return [x_text, y]
+return x_text, y
 
 
 def pad_sentences(sentences, padding_word=""):
 """
-Pads all sentences to the same length. The length is defined by the 
longest sentence.
+   

[GitHub] eric-haibin-lin opened a new pull request #9038: Add truncated bptt RNN example using symbol & module API

2017-12-12 Thread GitBox
eric-haibin-lin opened a new pull request #9038: Add truncated bptt RNN example 
using symbol & module API
URL: https://github.com/apache/incubator-mxnet/pull/9038
 
 
   ## Description ##
   @szha @sxjscience 
   
   I added the global_clip_norm functionality to a custom module wrapper in 
this example instead of adding it to `mx.module.Module`
   
   ## 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 ###
   
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Interesting edge cases to note here
   


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


With regards,
Apache Git Services


[GitHub] szha opened a new pull request #9039: update autograd.Function docstring for usage

2017-12-12 Thread GitBox
szha opened a new pull request #9039: update autograd.Function docstring for 
usage
URL: https://github.com/apache/incubator-mxnet/pull/9039
 
 
   ## Description ##
   Update docstring for autograd.Function to include usage.
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [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] update autograd.Function docstring.
   


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156484820
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -1,43 +1,43 @@
-# Generative Adversarial Networks
+# Generative Adversarial Networks (GAN)
 
 Review comment:
   nitpick: "Generative Adversarial Network" (no s at the end) or use "GAN**s**"


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156491258
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -86,25 +86,25 @@ Since the DCGAN that we're creating takes in a 64x64 image 
as the input, we'll u
 import cv2
 X = np.asarray([cv2.resize(x, (64,64)) for x in X])
 ```
-Each pixel in our 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into our DCGAN, as suggested by the research paper. To rescale 
our pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put our images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
+Each pixel in the 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into the DCGAN, as suggested by the research paper. To rescale 
the pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put the images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
 ```python
 X = X.astype(np.float32)/(255.0/2) - 1.0
 ```
-Ultimately, images are inputted into our neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to our images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent our dataset. We will 
pad the other channels with 0's:
+Ultimately, images are inputted into the neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to the images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent the dataset. We will 
pad the other channels with 0's:
 
 ```python
 X = X.reshape((7, 1, 64, 64))
 X = np.tile(X, (1, 3, 1, 1))
 ```
-Finally, we'll put our images into MXNet's NDArrayIter, which will allow MXNet 
to easily iterate through our images during training. We'll also split up them 
images into a batches, with 64 images in each batch. Every time we iterate, 
we'll get a 4 dimensional array with size (64, 3, 64, 64), representing a batch 
of 64 images.
+Finally, we will put the images into MXNet's NDArrayIter, which will allow 
MXNet to easily iterate through the images during training. We will also split 
up them images into a batches, with 64 images in each batch. Every time we 
iterate, we'll get a 4 dimensional array with size (64, 3, 64, 64), 
representing a batch of 64 images.
 
 Review comment:
   "split up them images into a batches, with 64 images in each batch" => 
"split them up into batches of 64 images each"


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156484051
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -1,43 +1,43 @@
-# Generative Adversarial Networks
+# Generative Adversarial Networks (GAN)
 
 GANs are an application of unsupervised learning - you don't need labels for 
your dataset in order to train a GAN.
- 
-The GAN framework composes of two neural networks: a generator network and a 
discriminator network.
 
-The generator's job is to take a set of random numbers and produce data (such 
as images or text).
+The GAN framework composes of two neural networks: a Generator network and a 
Discriminator network.
 
 Review comment:
   "composes" => "is composed of"


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156492396
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -86,25 +86,25 @@ Since the DCGAN that we're creating takes in a 64x64 image 
as the input, we'll u
 import cv2
 X = np.asarray([cv2.resize(x, (64,64)) for x in X])
 ```
-Each pixel in our 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into our DCGAN, as suggested by the research paper. To rescale 
our pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put our images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
+Each pixel in the 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into the DCGAN, as suggested by the research paper. To rescale 
the pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put the images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
 ```python
 X = X.astype(np.float32)/(255.0/2) - 1.0
 ```
-Ultimately, images are inputted into our neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to our images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent our dataset. We will 
pad the other channels with 0's:
+Ultimately, images are inputted into the neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to the images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent the dataset. We will 
pad the other channels with 0's:
 
 ```python
 X = X.reshape((7, 1, 64, 64))
 X = np.tile(X, (1, 3, 1, 1))
 ```
-Finally, we'll put our images into MXNet's NDArrayIter, which will allow MXNet 
to easily iterate through our images during training. We'll also split up them 
images into a batches, with 64 images in each batch. Every time we iterate, 
we'll get a 4 dimensional array with size (64, 3, 64, 64), representing a batch 
of 64 images.
+Finally, we will put the images into MXNet's NDArrayIter, which will allow 
MXNet to easily iterate through the images during training. We will also split 
up them images into a batches, with 64 images in each batch. Every time we 
iterate, we'll get a 4 dimensional array with size (64, 3, 64, 64), 
representing a batch of 64 images.
 ```python
 import mxnet as mx
 batch_size = 64
 image_iter = mx.io.NDArrayIter(X, batch_size=batch_size)
 ```
 ### 2. Preparing Random Numbers
 
-We need to input random numbers from a normal distribution to our generator 
network, so we'll create an MXNet DataIter that produces random numbers for 
each training batch. The DataIter is the base class of MXNet's Data Loading 
API. Below, we create a class called RandIter which is a subclass of DataIter. 
We use MXNet's built in mx.random.normal function in order to return the 
normally distributed random numbers every time we iterate.
+We need to input random numbers from a normal distribution to the Generator 
network, so we'll create an MXNet DataIter that produces random numbers for 
each training batch. The DataIter is the base class of MXNet's Data Loading 
API. Below, we create a class called RandIter which is a subclass of DataIter. 
We use MXNet's built in mx.random.normal function in order to return the 
normally distributed random numbers every time we iterate.
 
 Review comment:
   Wasn't there any guideline on attaching decorations when references to code 
are made. E.g. DataIter, RandIter
   
   "built in" => "built-in"
   
   Also consider rewording:
   "return the normally distributed random numbers every time we iterate." => 
"return numbers from a normal distribution during the iteration."


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156490895
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -86,25 +86,25 @@ Since the DCGAN that we're creating takes in a 64x64 image 
as the input, we'll u
 import cv2
 X = np.asarray([cv2.resize(x, (64,64)) for x in X])
 ```
-Each pixel in our 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into our DCGAN, as suggested by the research paper. To rescale 
our pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put our images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
+Each pixel in the 64x64 image is represented by a number between 0-255, that 
represents the intensity of the pixel. However, we want to input numbers 
between -1 and 1 into the DCGAN, as suggested by the research paper. To rescale 
the pixels to be in the range of -1 to 1, we'll divide each pixel by (255/2). 
This put the images on a scale of 0-2. We can then subtract by 1, to get them 
in the range of -1 to 1.
 ```python
 X = X.astype(np.float32)/(255.0/2) - 1.0
 ```
-Ultimately, images are inputted into our neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to our images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent our dataset. We will 
pad the other channels with 0's:
+Ultimately, images are inputted into the neural net from a 7x3x64x64 
array, and they are currently in a 7x64x64 array. We need to add 3 channels 
to the images. Typically when we are working with images, the 3 channels 
represent the red, green, and blue components of each image. Since the MNIST 
dataset is grayscale, we only need 1 channel to represent the dataset. We will 
pad the other channels with 0's:
 
 Review comment:
   I had to convince myself by reading 
[this](https://www.merriam-webster.com/words-at-play/is-inputted-a-word) that 
_inputted_ is actually a word :). 
   
   May be paraphrasing it this way sounds better: "Ultimately, images are 
_**fed**_ into the neural net _**through**_ a 7x3x64x64 array _**but**_ 
they are currently in a 7x64x64 array. We need to add 3 channels to the 
images. ".
   


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156488669
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -47,31 +47,31 @@ To complete this tutorial, you need:
 - Python 2.7, and the following libraries for Python:
 - Numpy - for matrix math
 - OpenCV - for image manipulation
-- Scikit-learn - to easily get our dataset
-- Matplotlib - to visualize our output
+- Scikit-learn - to easily get the MNIST dataset
+- Matplotlib - to visualize the output
 
 ## The Data
-We need two pieces of data to train our DCGAN:
+We need two pieces of data to train the DCGAN:
 1. Images of handwritten digits from the MNIST dataset
 2. Random numbers from a normal distribution
 
-Our generator network will use the random numbers as the input to produce 
images of handwritten digits, and out discriminator network will use images of 
handwritten digits from the MNIST dataset to determine if images produced by 
our generator are realistic.
+The Generator network will use the random numbers as the input to produce the 
images of handwritten digits, and the Discriminator network will use images of 
handwritten digits from the MNIST dataset to determine if images produced by 
the Generator are realistic.
 
-We are going to use the python library, scikit-learn, to get the MNIST 
dataset. Scikit-learn comes with a function that gets the dataset for us, which 
we will then manipulate to create our training and testing inputs.
+We are going to use the python library, scikit-learn, to get the MNIST 
dataset. Scikit-learn comes with a function that gets the dataset for us, which 
we will then manipulate to create the training and testing inputs.
 
 The MNIST dataset contains 70,000 images of handwritten digits. Each image is 
28x28 pixels in size. To create random numbers, we're going to create a custom 
MXNet data iterator, which will returns random numbers from a normal 
distribution as we need then.
 
 ## Prepare the Data
 
 ### 1. Preparing the MNSIT dataset
 
-Let's start by preparing our handwritten digits from the MNIST dataset. We 
import the fetch_mldata function from scikit-learn, and use it to get the MNSIT 
dataset. Notice that it's shape is 7x784. This contains the 7 images on 
every row and 784 pixels of each image in the columns of each row. Each image 
is 28x28 pixels, but has been flattened so that all 784 images are represented 
in a single list.
+Let us start by preparing the handwritten digits from the MNIST dataset. We 
import the fetch_mldata function from scikit-learn, and use it to get the MNSIT 
dataset. Notice that it's shape is 7x784. This contains the 7 images on 
every row and 784 pixels of each image in the columns of each row. Each image 
is 28x28 pixels, but has been flattened so that all 784 images are represented 
in a single list.
 ```python
 from sklearn.datasets import fetch_mldata
 mnist = fetch_mldata('MNIST original')
 ```
 
-Next, we'll randomize the handwritten digits by using numpy to create random 
permutations on the dataset on our rows (images). We'll then reshape our 
dataset from 7x786 to 7x28x28, so that every image in our dataset is 
arranged into a 28x28 grid, where each cell in the grid represents 1 pixel of 
the image.
+Next, we'll randomize the handwritten digits by using numpy to create random 
permutations on the dataset on the rows (images). We will then reshape the 
dataset from 7x786 to 7x28x28, so that every image in the dataset is 
arranged into a 28x28 grid, where each cell in the grid represents 1 pixel of 
the image.
 
 Review comment:
   Just curious: Is there a guideline around when to use _we'll_ and when to 
use _we will_. In this sentence, I see both.


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9030: Fix Gan

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9030: Fix Gan
URL: https://github.com/apache/incubator-mxnet/pull/9030#discussion_r156488038
 
 

 ##
 File path: docs/tutorials/unsupervised_learning/gan.md
 ##
 @@ -1,43 +1,43 @@
-# Generative Adversarial Networks
+# Generative Adversarial Networks (GAN)
 
 GANs are an application of unsupervised learning - you don't need labels for 
your dataset in order to train a GAN.
- 
-The GAN framework composes of two neural networks: a generator network and a 
discriminator network.
 
-The generator's job is to take a set of random numbers and produce data (such 
as images or text).
+The GAN framework composes of two neural networks: a Generator network and a 
Discriminator network.
 
-The discriminator then takes in that data as well as samples of that data from 
a dataset and tries to determine if is "fake" (created by the generator 
network) or "real" (from the original dataset).
+The Generator's job is to take a set of random numbers and produce the data 
(such as images or text).
 
-During training, the two networks play a game against each other. The 
generator tries to create realistic data, so that it can fool the discriminator 
into thinking that the data it generated is from the original dataset. At the 
same time, the discriminator tries to not be fooled - it learns to become 
better at determining if data is real or fake.
+The Discriminator then takes in that data as well as samples of that data from 
a dataset and tries to determine if it is "fake" (created by the Generator 
network) or "real" (from the original dataset).
 
-Since the two networks are fighting in this game, they can be seen as as 
adversaries, which is where the term "Generative Adverserial Network" comes 
from.
+During training, the two networks play a game against each other. The 
Generator tries to create realistic data, so that it can fool the Discriminator 
into thinking that the data it generated is from the original dataset. At the 
same time, the Discriminator tries to not be fooled - it learns to become 
better at determining if data is real or fake.
+
+Since the two networks are fighting in this game, they can be seen as as 
adversaries, which is where the term "Generative Adversarial Network" comes 
from.
 
 ## Deep Convolutional Generative Adversarial Networks
 
 This tutorial takes a look at Deep Convolutional Generative Adversarial 
Networks (DCGAN), which combines Convolutional Neural Networks (CNNs) and GANs.
 
-We will create a DCGAN that is able to create images of handwritten digits 
from random numbers.The tutorial uses the neural net architecture and 
guidelines outlined in [this paper](https://arxiv.org/abs/1511.06434), and the 
MNIST dataset.
+We will create a DCGAN that is able to create images of handwritten digits 
from random numbers. The tutorial uses the neural net architecture and 
guidelines outlined in [this paper](https://arxiv.org/abs/1511.06434), and the 
MNIST dataset.
 
-##How to Use This Tutorial
+## How to Use This Tutorial
 You can use this tutorial by executing each snippet of python code in order as 
it appears in the tutorial.
 
 
-1. The first net is the "generator" and creates images of handwritten digits 
from random numbers.
-2. The second net is the "discriminator" and determines if the image created 
by the generator is real (a realistic looking image of handwritten digits) or 
fake (an image that doesn't look like it came from the original dataset).
-
+1. The first net is the "Generator" and creates images of handwritten digits 
from random numbers.
+2. The second net is the "Discriminator" and determines if the image created 
by the Generator is real (a realistic looking image of handwritten digits) or 
fake (an image that does not look like it is from the original dataset).
+
 Apart from creating a DCGAN, you'll also learn:
 
-- How to manipulate and iterate through batches images that you can feed into 
your neural network.
+- How to manipulate and iterate through batches of image data that you can 
feed into your neural network.
 
 - How to create a custom MXNet data iterator that generates random numbers 
from a normal distribution.
 
-- How to create a custom training process in MXNet, using lower level 
functions from the MXNet Module API such as .bind() .forward() and .backward(). 
The training process for a DCGAN is more complex than many other neural net's, 
so we need to use these functions instead of using the higher level .fit() 
function.
+- How to create a custom training process in MXNet, using lower level 
functions from the MXNet Module API such as .bind() .forward() and .backward(). 
The training process for a DCGAN is more complex than many other neural 
networks, so we need to use these functions instead of using the higher level 
.fit() function.
 
 - How to visualize images as they are going through the training process
 
 ## Prerequisites
 
-This tutorial assumes you're familiar with the 

[GitHub] pracheer commented on a change in pull request #9027: Usability improvement for cnn_chinese_text_classification

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9027: Usability improvement for 
cnn_chinese_text_classification
URL: https://github.com/apache/incubator-mxnet/pull/9027#discussion_r156494304
 
 

 ##
 File path: example/cnn_chinese_text_classification/text_cnn.py
 ##
 @@ -20,20 +20,19 @@
 
 # -*- coding: utf-8 -*-
 
-import sys
-import os
+import sys, os
 import mxnet as mx
 import numpy as np
 import argparse
 import logging
-
 import time
 
 from mxnet import random
 from mxnet.initializer import Xavier, Initializer
 
 import data_helpers
 
+print("Training logs are generated in ./cnn_text_classification.log")
 
 Review comment:
   nitpick: There is only one log file. Isn't it? If yes, then this may be more 
appropriate "Training log is generated at ./cnn_text_classification.log" or 
"Training log can be found at cnn_text_classification.log"


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8874: mxnet installation from source: C++ linkage error on HPC

2017-12-12 Thread GitBox
larroy commented on issue #8874: mxnet installation from source: C++ linkage 
error on HPC
URL: 
https://github.com/apache/incubator-mxnet/issues/8874#issuecomment-351193968
 
 
   more compiler error context is required, which .cc file is failing to build? 
please paste more output.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9038: Add truncated bptt RNN example using symbol & module API

2017-12-12 Thread GitBox
sxjscience commented on issue #9038: Add truncated bptt RNN example using 
symbol & module API
URL: https://github.com/apache/incubator-mxnet/pull/9038#issuecomment-351195136
 
 
   I think adding this wrapper for the PTB example is a good way. This avoids 
the complexities of changing the APIs in the original Module class. This should 
be okay since we are transferring to gluon.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9038: Add truncated bptt RNN example using symbol & module API

2017-12-12 Thread GitBox
sxjscience commented on issue #9038: Add truncated bptt RNN example using 
symbol & module API
URL: https://github.com/apache/incubator-mxnet/pull/9038#issuecomment-351195136
 
 
   I think adding a new wrapper for the PTB example is a good way. This avoids 
the complexities of changing the APIs in the original Module class. This should 
be okay since we are transferring to gluon.


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


With regards,
Apache Git Services


[GitHub] pracheer commented on a change in pull request #9021: Remove redundant or unused imports

2017-12-12 Thread GitBox
pracheer commented on a change in pull request #9021: Remove redundant or 
unused imports
URL: https://github.com/apache/incubator-mxnet/pull/9021#discussion_r156496761
 
 

 ##
 File path: tests/python/unittest/test_ndarray.py
 ##
 @@ -15,15 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
-import os
-import mxnet as mx
-import numpy as np
 import pickle as pkl
 import unittest
 from nose.tools import raises
 from mxnet.test_utils import *
 
 Review comment:
   Minor: Can you also expand "from mxnet.test_utils import *" so as not to use 
*


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


With regards,
Apache Git Services


[GitHub] indhub commented on a change in pull request #9033: Rename the section titled 'MXNet' in tutorials page to 'Low Level Interface'

2017-12-12 Thread GitBox
indhub commented on a change in pull request #9033: Rename the section titled 
'MXNet' in tutorials page to 'Low Level Interface'
URL: https://github.com/apache/incubator-mxnet/pull/9033#discussion_r156497783
 
 

 ##
 File path: docs/tutorials/index.md
 ##
 @@ -27,9 +27,9 @@ This is a selected subset of Gluon tutorials that explains 
basic usage of Gluon
 - [Fast, portable neural networks with Gluon 
HybridBlocks](http://gluon.mxnet.io/chapter07_distributed-learning/hybridize.html)
 - [Training on multiple GPUs with 
gluon](http://gluon.mxnet.io/chapter07_distributed-learning/multiple-gpus-gluon.html)
 
-## MXNet
+## Low Level Interface
 
 Review comment:
   Yes, I'm reorganizing this page. I'll update the PR shortly.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
piiswrong commented on a change in pull request #9035: [WIP] Build 
improvements, for users and for Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#discussion_r156499301
 
 

 ##
 File path: Jenkinsfile
 ##
 @@ -228,31 +228,10 @@ try {
 'Build CPU windows':{
   node('mxnetwindows-cpu') {
 ws('workspace/build-cpu') {
-  withEnv(['OpenBLAS_HOME=C:\\mxnet\\openblas', 
'OpenCV_DIR=C:\\mxnet\\opencv_vc14', 'CUDA_PATH=C:\\CUDA\\v8.0']) {
-init_git_win()
-bat """mkdir build_vc14_cpu
-  call "C:\\Program Files (x86)\\Microsoft Visual Studio 
14.0\\VC\\bin\\x86_amd64\\vcvarsx86_amd64.bat"
-  cd build_vc14_cpu
-  cmake -G \"Visual Studio 14 2015 Win64\" -DUSE_CUDA=0 
-DUSE_CUDNN=0 -DUSE_NVRTC=0 -DUSE_OPENCV=1 -DUSE_OPENMP=1 -DUSE_PROFILER=1 
-DUSE_BLAS=open -DUSE_LAPACK=1 -DUSE_DIST_KVSTORE=0 ${env.WORKSPACE}"""
-bat 'C:\\mxnet\\build_vc14_cpu.bat'
-
-bat '''rmdir /s/q pkg_vc14_cpu
-  mkdir pkg_vc14_cpu\\lib
-  mkdir pkg_vc14_cpu\\python
-  mkdir pkg_vc14_cpu\\include
-  mkdir pkg_vc14_cpu\\build
-  copy build_vc14_cpu\\Release\\libmxnet.lib pkg_vc14_cpu\\lib
-  copy build_vc14_cpu\\Release\\libmxnet.dll pkg_vc14_cpu\\build
-  xcopy python pkg_vc14_cpu\\python /E /I /Y
-  xcopy include pkg_vc14_cpu\\include /E /I /Y
-  xcopy dmlc-core\\include pkg_vc14_cpu\\include /E /I /Y
-  xcopy mshadow\\mshadow pkg_vc14_cpu\\include\\mshadow /E /I /Y
-  xcopy nnvm\\include pkg_vc14_cpu\\nnvm\\include /E /I /Y
-  del /Q *.7z
-  7z.exe a vc14_cpu.7z pkg_vc14_cpu\\
-  '''
-stash includes: 'vc14_cpu.7z', name: 'vc14_cpu'
-  }
+  init_git_win()
+  bat '''
+python build.py
 
 Review comment:
   doesn't look like a good idea to use python. Why not build.bat?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9035: [WIP] Build improvements, for users and for Jenkins

2017-12-12 Thread GitBox
piiswrong commented on a change in pull request #9035: [WIP] Build 
improvements, for users and for Jenkins
URL: https://github.com/apache/incubator-mxnet/pull/9035#discussion_r156499753
 
 

 ##
 File path: build.py
 ##
 @@ -0,0 +1,167 @@
+#!/usr/bin/env python
+# -*- 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.
+
+"""User friendly / multi platform builder script"""
+
+import contextlib
+import subprocess
+import logging
+import os
+import tempfile
+import sys
+from distutils import spawn
+import logging
+from subprocess import check_call
+import platform
+import argparse
+
+@contextlib.contextmanager
+def remember_cwd():
+'''
+Restore current directory when exiting context
+'''
+curdir = os.getcwd()
+try: yield
+finally: os.chdir(curdir)
+
+
+class CmdResult(object):
+def __init__(self, cmd, std_out, std_err, status_code):
+self.std_out = std_out
+self.std_err = std_err
+self.status_code = status_code if status_code is not None else 0
+self.cmd = cmd
+
+def __str__(self):
+return "Command: \"{}\" status: {}\nstdout:\n{}\nstderr:\n{}".format(
+self.cmd, self.status_code,
+self.std_out[:50], self.std_err[:20])
+
+
+def run(cmd, fail_on_error=True):
+logging.debug("executing shell command:\n" + cmd)
+proc = subprocess.Popen(
+cmd,
+shell=True,
+stdout=subprocess.PIPE,
+stderr=subprocess.PIPE,
+)
+std_out, std_err = proc.communicate()
+if fail_on_error:
+if proc.returncode != 0:
+logging.warn('Error running command: {}'.format(cmd))
+assert proc.returncode == 0, std_err
+res = CmdResult(cmd, std_out.decode('utf-8'), std_err.decode('utf-8'), 
proc.returncode)
+return res
+
+def xmkdir(d):
+rev_path_list = list()
+head = d
+while len(head) and head != os.sep:
+rev_path_list.append(head)
+(head, tail) = os.path.split(head)
+
+rev_path_list.reverse()
+for p in rev_path_list:
+try:
+os.mkdir(p)
+except OSError as e:
+if e.errno != 17:
+raise
+
+
+
+def windows_build(args):
+BUILD_BAT=r'''call "C:\Program Files (x86)\Microsoft Visual Studio 
14.0\VC\bin\x86_amd64\vcvarsx86_amd64.bat"
 
 Review comment:
   This isn't generic enough to be a script under root


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8919: [Vision] add test cases for flip, normalize, to_tensor

2017-12-12 Thread GitBox
piiswrong closed pull request #8919: [Vision] add test cases for flip, 
normalize, to_tensor
URL: https://github.com/apache/incubator-mxnet/pull/8919
 
 
   

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

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

diff --git a/python/mxnet/gluon/data/vision/transforms.py 
b/python/mxnet/gluon/data/vision/transforms.py
index 8daf88e6f4..38eb6902dc 100644
--- a/python/mxnet/gluon/data/vision/transforms.py
+++ b/python/mxnet/gluon/data/vision/transforms.py
@@ -184,26 +184,26 @@ def forward(self, x):
 return image.imresize(x, *self._args)
 
 
-class RandomHorizontalFlip(HybridBlock):
-"""Randomly flip the input image horizontally with a probability
+class RandomFlipLeftRight(HybridBlock):
+"""Randomly flip the input image left to right with a probability
 of 0.5.
 """
 def __init__(self):
-super(RandomHorizontalFlip, self).__init__()
+super(RandomFlipLeftRight, self).__init__()
 
 def hybrid_forward(self, F, x):
-return F.image.random_horizontal_flip(x)
+return F.image.random_flip_left_right(x)
 
 
-class RandomVerticalFlip(HybridBlock):
-"""Randomly flip the input image vertically with a probability
+class RandomFlipTopBottom(HybridBlock):
+"""Randomly flip the input image top to bottom with a probability
 of 0.5.
 """
 def __init__(self):
-super(RandomVerticalFlip, self).__init__()
+super(RandomFlipTopBottom, self).__init__()
 
 def hybrid_forward(self, F, x):
-return F.image.random_vertical_flip(x)
+return F.image.random_flip_top_bottom(x)
 
 
 class RandomBrightness(HybridBlock):
diff --git a/src/operator/image/image_random-inl.h 
b/src/operator/image/image_random-inl.h
index cbc7f4012b..ec961492f9 100644
--- a/src/operator/image/image_random-inl.h
+++ b/src/operator/image/image_random-inl.h
@@ -85,14 +85,6 @@ void ToTensor(const nnvm::NodeAttrs ,
   });
 }
 
-inline bool TensorShape(const nnvm::NodeAttrs& attrs,
-   std::vector *in_attrs,
-   std::vector *out_attrs) {
-  TShape& dshape = (*in_attrs)[0];
-  SHAPE_ASSIGN_CHECK(*out_attrs, 0, dshape);
-  return true;
-}
-
 struct NormalizeParam : public dmlc::Parameter {
   nnvm::Tuple mean;
   nnvm::Tuple std;
@@ -179,16 +171,16 @@ inline bool ImageShape(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
-template
-void FlipImpl(const TShape , DType *src, DType *dst, int axis) {
+template
+void FlipImpl(const TShape , DType *src, DType *dst) {
   int head = 1, mid = shape[axis], tail = 1;
   for (int i = 0; i < axis; ++i) head *= shape[i];
   for (int i = axis+1; i < shape.ndim(); ++i) tail *= shape[i];
 
   for (int i = 0; i < head; ++i) {
-for (int j = 0; j < (mid >>2); ++j) {
-  int idx1 = (i*mid + j)*tail;
-  int idx2 = idx1 + (mid - (j<<2))*tail;
+for (int j = 0; j < (mid >> 1); ++j) {
+  int idx1 = (i*mid + j) * tail;
+  int idx2 = idx1 + (mid-(j << 1)-1) * tail;
   for (int k = 0; k < tail; ++k, ++idx1, ++idx2) {
 DType tmp = src[idx1];
 dst[idx1] = src[idx2];
@@ -198,7 +190,31 @@ void FlipImpl(const TShape , DType *src, DType *dst, 
int axis) {
   }
 }
 
-void RandomHorizontalFlip(
+void FlipLeftRight(const nnvm::NodeAttrs ,
+   const OpContext ,
+   const std::vector ,
+   const std::vector ,
+   const std::vector ) {
+  using namespace mshadow;
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+FlipImpl(inputs[0].shape_, inputs[0].dptr(),
+   outputs[0].dptr());
+  });
+}
+
+void FlipTopBottom(const nnvm::NodeAttrs ,
+   const OpContext ,
+   const std::vector ,
+   const std::vector ,
+   const std::vector ) {
+  using namespace mshadow;
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+FlipImpl(inputs[0].shape_, inputs[0].dptr(),
+   outputs[0].dptr());
+  });
+}
+
+void RandomFlipLeftRight(
 const nnvm::NodeAttrs ,
 const OpContext ,
 const std::vector ,
@@ -207,14 +223,19 @@ void RandomHorizontalFlip(
   using namespace mshadow;
   Stream *s = ctx.get_stream();
   Random *prnd = ctx.requested[0].get_random(s);
-  if (std::bernoulli_distribution()(prnd->GetRndEngine())) return;
   MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-FlipImpl(inputs[0].shape_, inputs[0].dptr(),
- outputs[0].dptr(), 1);
+if (std::bernoulli_distribution()(prnd->GetRndEngine())) {
+  if (outputs[0].dptr_ != inputs[0].dptr_) {
+std::memcpy(outputs[0].dptr_, inputs[0].dptr_, inputs[0].Size() * 
sizeof(DType));
+  }
+} else {
+  FlipImpl(inputs[0].shape_, inputs[0].dptr(),
+ 

[incubator-mxnet] branch vision updated: [Vision] add test cases for flip, normalize, to_tensor (#8919)

2017-12-12 Thread jxie
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/vision by this push:
 new 7c92b98  [Vision] add test cases for flip, normalize, to_tensor (#8919)
7c92b98 is described below

commit 7c92b98a295e9a8a5e0af8d2c641e1ab7dcfd93d
Author: Yizhi Liu 
AuthorDate: Tue Dec 12 13:28:41 2017 -0800

[Vision] add test cases for flip, normalize, to_tensor (#8919)

* [vision] ut for to_tensor, normalize, flip

* [vision] fix flip

* [vision] flip name

* [vision] test non-random flip op

* remove transform.Flip
---
 python/mxnet/gluon/data/vision/transforms.py| 16 +++---
 src/operator/image/image_random-inl.h   | 68 +
 src/operator/image/image_random.cc  | 16 --
 tests/python/unittest/test_gluon_data_vision.py | 41 ++-
 4 files changed, 96 insertions(+), 45 deletions(-)

diff --git a/python/mxnet/gluon/data/vision/transforms.py 
b/python/mxnet/gluon/data/vision/transforms.py
index 8daf88e..38eb690 100644
--- a/python/mxnet/gluon/data/vision/transforms.py
+++ b/python/mxnet/gluon/data/vision/transforms.py
@@ -184,26 +184,26 @@ class Resize(Block):
 return image.imresize(x, *self._args)
 
 
-class RandomHorizontalFlip(HybridBlock):
-"""Randomly flip the input image horizontally with a probability
+class RandomFlipLeftRight(HybridBlock):
+"""Randomly flip the input image left to right with a probability
 of 0.5.
 """
 def __init__(self):
-super(RandomHorizontalFlip, self).__init__()
+super(RandomFlipLeftRight, self).__init__()
 
 def hybrid_forward(self, F, x):
-return F.image.random_horizontal_flip(x)
+return F.image.random_flip_left_right(x)
 
 
-class RandomVerticalFlip(HybridBlock):
-"""Randomly flip the input image vertically with a probability
+class RandomFlipTopBottom(HybridBlock):
+"""Randomly flip the input image top to bottom with a probability
 of 0.5.
 """
 def __init__(self):
-super(RandomVerticalFlip, self).__init__()
+super(RandomFlipTopBottom, self).__init__()
 
 def hybrid_forward(self, F, x):
-return F.image.random_vertical_flip(x)
+return F.image.random_flip_top_bottom(x)
 
 
 class RandomBrightness(HybridBlock):
diff --git a/src/operator/image/image_random-inl.h 
b/src/operator/image/image_random-inl.h
index cbc7f40..ec96149 100644
--- a/src/operator/image/image_random-inl.h
+++ b/src/operator/image/image_random-inl.h
@@ -85,14 +85,6 @@ void ToTensor(const nnvm::NodeAttrs ,
   });
 }
 
-inline bool TensorShape(const nnvm::NodeAttrs& attrs,
-   std::vector *in_attrs,
-   std::vector *out_attrs) {
-  TShape& dshape = (*in_attrs)[0];
-  SHAPE_ASSIGN_CHECK(*out_attrs, 0, dshape);
-  return true;
-}
-
 struct NormalizeParam : public dmlc::Parameter {
   nnvm::Tuple mean;
   nnvm::Tuple std;
@@ -179,16 +171,16 @@ inline bool ImageShape(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
-template
-void FlipImpl(const TShape , DType *src, DType *dst, int axis) {
+template
+void FlipImpl(const TShape , DType *src, DType *dst) {
   int head = 1, mid = shape[axis], tail = 1;
   for (int i = 0; i < axis; ++i) head *= shape[i];
   for (int i = axis+1; i < shape.ndim(); ++i) tail *= shape[i];
 
   for (int i = 0; i < head; ++i) {
-for (int j = 0; j < (mid >>2); ++j) {
-  int idx1 = (i*mid + j)*tail;
-  int idx2 = idx1 + (mid - (j<<2))*tail;
+for (int j = 0; j < (mid >> 1); ++j) {
+  int idx1 = (i*mid + j) * tail;
+  int idx2 = idx1 + (mid-(j << 1)-1) * tail;
   for (int k = 0; k < tail; ++k, ++idx1, ++idx2) {
 DType tmp = src[idx1];
 dst[idx1] = src[idx2];
@@ -198,7 +190,31 @@ void FlipImpl(const TShape , DType *src, DType *dst, 
int axis) {
   }
 }
 
-void RandomHorizontalFlip(
+void FlipLeftRight(const nnvm::NodeAttrs ,
+   const OpContext ,
+   const std::vector ,
+   const std::vector ,
+   const std::vector ) {
+  using namespace mshadow;
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+FlipImpl(inputs[0].shape_, inputs[0].dptr(),
+   outputs[0].dptr());
+  });
+}
+
+void FlipTopBottom(const nnvm::NodeAttrs ,
+   const OpContext ,
+   const std::vector ,
+   const std::vector ,
+   const std::vector ) {
+  using namespace mshadow;
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+FlipImpl(inputs[0].shape_, inputs[0].dptr(),
+   outputs[0].dptr());
+  });
+}
+
+void RandomFlipLeftRight(
 const nnvm::NodeAttrs ,
 const OpContext ,
 const std::vector ,
@@ -207,14 +223,19 @@ void 

[GitHub] astonzhang commented on a change in pull request #9021: Remove redundant or unused imports

2017-12-12 Thread GitBox
astonzhang commented on a change in pull request #9021: Remove redundant or 
unused imports
URL: https://github.com/apache/incubator-mxnet/pull/9021#discussion_r156500452
 
 

 ##
 File path: tests/python/unittest/test_ndarray.py
 ##
 @@ -15,15 +15,11 @@
 # specific language governing permissions and limitations
 # under the License.
 
-import os
-import mxnet as mx
-import numpy as np
 import pickle as pkl
 import unittest
 from nose.tools import raises
 from mxnet.test_utils import *
 
 Review comment:
   resolved


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


With regards,
Apache Git Services


[GitHub] szha opened a new pull request #9040: add zero-grad for rounding ops

2017-12-12 Thread GitBox
szha opened a new pull request #9040: add zero-grad for rounding ops
URL: https://github.com/apache/incubator-mxnet/pull/9040
 
 
   ## Description ##
   add zero gradients to rounding operators including 'rint', 'ceil', 'floor', 
'trunc', and 'fix'.
   
   ## 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] register FGradient with MakeZeroGradNodes for 'rint', 'ceil', 'floor', 
'trunc', 'fix'


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9041: Scala API doc doesn't show available operators

2017-12-12 Thread GitBox
eric-haibin-lin opened a new issue #9041: Scala API doc doesn't show available 
operators
URL: https://github.com/apache/incubator-mxnet/issues/9041
 
 
   As I browse the scala [API 
doc](https://mxnet.incubator.apache.org/api/scala/docs/index.html#ml.dmlc.mxnet.NDArray),
 I don't see any documentation regarding the available operators. This affects 
the usability of scala users. 


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


With regards,
Apache Git Services


[GitHub] piiswrong closed pull request #9038: Add truncated bptt RNN example using symbol & module API

2017-12-12 Thread GitBox
piiswrong closed pull request #9038: Add truncated bptt RNN example using 
symbol & module API
URL: https://github.com/apache/incubator-mxnet/pull/9038
 
 
   

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

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

diff --git a/example/rnn/README.md b/example/rnn/README.md
index 8a6f29d2c0..f0d80c3a61 100644
--- a/example/rnn/README.md
+++ b/example/rnn/README.md
@@ -1,15 +1,14 @@
-RNN Example
+Recurrent Neural Network Examples
 ===
-This folder contains RNN examples using high level mxnet.rnn interface.
 
-Examples using low level symbol interface have been deprecated and moved to 
old/
+This directory contains functions for creating recurrent neural networks
+models using high level mxnet.rnn interface.
 
-## Data
-Run `get_ptb_data.sh` to download PenTreeBank data.
+Here is a short overview of what is in this directory.
 
-## Python
-
-- [lstm_bucketing.py](lstm_bucketing.py) PennTreeBank language model by using 
LSTM
-
-Performance Note:
-More ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For 
setting ```MXNET_GPU_WORKER_NTHREADS```, please refer to [Environment 
Variables](https://mxnet.readthedocs.org/en/latest/how_to/env_var.html).
+Directory | What's in it?
+--- | ---
+`word_lm/` | Language model trained on the PTB dataset achieving state of the 
art performance
+`bucketing/` | Language model with bucketing API with python
+`bucket_R/` | Language model with bucketing API with R
+`old/` | Language model trained with low level symbol interface (deprecated)
diff --git a/example/rnn/bucketing/README.md b/example/rnn/bucketing/README.md
new file mode 100644
index 00..6baf1ecae9
--- /dev/null
+++ b/example/rnn/bucketing/README.md
@@ -0,0 +1,13 @@
+RNN Example
+===
+This folder contains RNN examples using high level mxnet.rnn interface.
+
+## Data
+Run `get_ptb_data.sh` to download PenTreeBank data.
+
+## Python
+
+- [lstm_bucketing.py](lstm_bucketing.py) PennTreeBank language model by using 
LSTM
+
+Performance Note:
+More ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For 
setting ```MXNET_GPU_WORKER_NTHREADS```, please refer to [Environment 
Variables](https://mxnet.readthedocs.org/en/latest/how_to/env_var.html).
diff --git a/example/rnn/cudnn_lstm_bucketing.py 
b/example/rnn/bucketing/cudnn_lstm_bucketing.py
similarity index 100%
rename from example/rnn/cudnn_lstm_bucketing.py
rename to example/rnn/bucketing/cudnn_lstm_bucketing.py
diff --git a/example/rnn/get_ptb_data.sh b/example/rnn/bucketing/get_ptb_data.sh
similarity index 100%
rename from example/rnn/get_ptb_data.sh
rename to example/rnn/bucketing/get_ptb_data.sh
diff --git a/example/rnn/lstm_bucketing.py 
b/example/rnn/bucketing/lstm_bucketing.py
similarity index 100%
rename from example/rnn/lstm_bucketing.py
rename to example/rnn/bucketing/lstm_bucketing.py
diff --git a/example/rnn/word_lm/README.md b/example/rnn/word_lm/README.md
new file mode 100644
index 00..c4980326e4
--- /dev/null
+++ b/example/rnn/word_lm/README.md
@@ -0,0 +1,49 @@
+Word Level Language Modeling
+===
+This example trains a multi-layer LSTM on Penn Treebank (PTB) language 
modeling benchmark.
+
+The following techniques have been adopted for SOTA results:
+- [LSTM for LM](https://arxiv.org/pdf/1409.2329.pdf)
+- [Weight tying](https://arxiv.org/abs/1608.05859) between word vectors and 
softmax output embeddings
+
+## Prerequisite
+The example requires MXNet built with CUDA.
+
+## Data
+The PTB data is the processed version from [(Mikolov et al, 
2010)](http://www.fit.vutbr.cz/research/groups/speech/publi/2010/mikolov_interspeech2010_IS100722.pdf):
+
+## Usage
+Example runs and the results:
+
+```
+python train.py --tied --nhid 650 --emsize 650 --dropout 0.5# Test ppl 
of 75.4
+```
+
+```
+usage: train.py [-h] [--data DATA] [--emsize EMSIZE] [--nhid NHID]
+[--nlayers NLAYERS] [--lr LR] [--clip CLIP] [--epochs EPOCHS]
+[--batch_size BATCH_SIZE] [--dropout DROPOUT] [--tied]
+[--bptt BPTT] [--log-interval LOG_INTERVAL] [--seed SEED]
+
+PennTreeBank LSTM Language Model
+
+optional arguments:
+  -h, --helpshow this help message and exit
+  --data DATA   location of the data corpus
+  --emsize EMSIZE   size of word embeddings
+  --nhid NHID   number of hidden units per layer
+  --nlayers NLAYERS number of layers
+  --lr LR   initial learning rate
+  --clip CLIP   gradient clipping by global norm
+  --epochs EPOCHS   upper epoch limit
+  --batch_size BATCH_SIZE
+batch size
+  --dropout DROPOUT dropout applied to layers (0 = no dropout)
+  --tiedtie the word embedding and softmax weights
+  --bptt BPTT   sequence length
+  

[incubator-mxnet] branch master updated: Add truncated bptt RNN example using symbol & module API (#9038)

2017-12-12 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 06ed4dc  Add truncated bptt RNN example using symbol & module API 
(#9038)
06ed4dc is described below

commit 06ed4dcb1ab6aa1c506dbd3d7bb052b123f63589
Author: Haibin Lin 
AuthorDate: Tue Dec 12 13:42:05 2017 -0800

Add truncated bptt RNN example using symbol & module API (#9038)

* restructure folder

* initial commmit

* update doc

* one more fix

* update dfault args and readme

* update data
---
 example/rnn/README.md  |  21 ++--
 example/rnn/{ => bucketing}/README.md  |   2 -
 .../rnn/{ => bucketing}/cudnn_lstm_bucketing.py|   0
 example/rnn/{ => bucketing}/get_ptb_data.sh|   0
 example/rnn/{ => bucketing}/lstm_bucketing.py  |   0
 example/rnn/word_lm/README.md  |  49 
 example/rnn/word_lm/data.py| 114 +
 example/rnn/{ => word_lm}/get_ptb_data.sh  |  13 +-
 example/rnn/word_lm/model.py   |  67 ++
 example/rnn/word_lm/module.py  | 134 
 example/rnn/word_lm/train.py   | 136 +
 11 files changed, 519 insertions(+), 17 deletions(-)

diff --git a/example/rnn/README.md b/example/rnn/README.md
index 8a6f29d..f0d80c3 100644
--- a/example/rnn/README.md
+++ b/example/rnn/README.md
@@ -1,15 +1,14 @@
-RNN Example
+Recurrent Neural Network Examples
 ===
-This folder contains RNN examples using high level mxnet.rnn interface.
 
-Examples using low level symbol interface have been deprecated and moved to 
old/
+This directory contains functions for creating recurrent neural networks
+models using high level mxnet.rnn interface.
 
-## Data
-Run `get_ptb_data.sh` to download PenTreeBank data.
+Here is a short overview of what is in this directory.
 
-## Python
-
-- [lstm_bucketing.py](lstm_bucketing.py) PennTreeBank language model by using 
LSTM
-
-Performance Note:
-More ```MXNET_GPU_WORKER_NTHREADS``` may lead to better performance. For 
setting ```MXNET_GPU_WORKER_NTHREADS```, please refer to [Environment 
Variables](https://mxnet.readthedocs.org/en/latest/how_to/env_var.html).
+Directory | What's in it?
+--- | ---
+`word_lm/` | Language model trained on the PTB dataset achieving state of the 
art performance
+`bucketing/` | Language model with bucketing API with python
+`bucket_R/` | Language model with bucketing API with R
+`old/` | Language model trained with low level symbol interface (deprecated)
diff --git a/example/rnn/README.md b/example/rnn/bucketing/README.md
similarity index 85%
copy from example/rnn/README.md
copy to example/rnn/bucketing/README.md
index 8a6f29d..6baf1ec 100644
--- a/example/rnn/README.md
+++ b/example/rnn/bucketing/README.md
@@ -2,8 +2,6 @@ RNN Example
 ===
 This folder contains RNN examples using high level mxnet.rnn interface.
 
-Examples using low level symbol interface have been deprecated and moved to 
old/
-
 ## Data
 Run `get_ptb_data.sh` to download PenTreeBank data.
 
diff --git a/example/rnn/cudnn_lstm_bucketing.py 
b/example/rnn/bucketing/cudnn_lstm_bucketing.py
similarity index 100%
rename from example/rnn/cudnn_lstm_bucketing.py
rename to example/rnn/bucketing/cudnn_lstm_bucketing.py
diff --git a/example/rnn/get_ptb_data.sh b/example/rnn/bucketing/get_ptb_data.sh
similarity index 100%
copy from example/rnn/get_ptb_data.sh
copy to example/rnn/bucketing/get_ptb_data.sh
diff --git a/example/rnn/lstm_bucketing.py 
b/example/rnn/bucketing/lstm_bucketing.py
similarity index 100%
rename from example/rnn/lstm_bucketing.py
rename to example/rnn/bucketing/lstm_bucketing.py
diff --git a/example/rnn/word_lm/README.md b/example/rnn/word_lm/README.md
new file mode 100644
index 000..c498032
--- /dev/null
+++ b/example/rnn/word_lm/README.md
@@ -0,0 +1,49 @@
+Word Level Language Modeling
+===
+This example trains a multi-layer LSTM on Penn Treebank (PTB) language 
modeling benchmark.
+
+The following techniques have been adopted for SOTA results:
+- [LSTM for LM](https://arxiv.org/pdf/1409.2329.pdf)
+- [Weight tying](https://arxiv.org/abs/1608.05859) between word vectors and 
softmax output embeddings
+
+## Prerequisite
+The example requires MXNet built with CUDA.
+
+## Data
+The PTB data is the processed version from [(Mikolov et al, 
2010)](http://www.fit.vutbr.cz/research/groups/speech/publi/2010/mikolov_interspeech2010_IS100722.pdf):
+
+## Usage
+Example runs and the results:
+
+```
+python train.py --tied --nhid 650 --emsize 650 --dropout 0.5# Test ppl 
of 75.4
+```
+
+```
+usage: train.py [-h] [--data DATA] [--emsize EMSIZE] [--nhid NHID]
+[--nlayers NLAYERS] [--lr 

[GitHub] piiswrong commented on issue #9016: Add googletest as a 3rdparty library

2017-12-12 Thread GitBox
piiswrong commented on issue #9016: Add googletest as a 3rdparty library
URL: https://github.com/apache/incubator-mxnet/pull/9016#issuecomment-351204543
 
 
   please add a submodule. Don't copy paste the code


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


With regards,
Apache Git Services


[incubator-mxnet] branch master updated: Use backtrace from dmlc-core with demangled C++ symbols on segfault (#8851)

2017-12-12 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 3901f5f  Use backtrace from dmlc-core with demangled C++ symbols on 
segfault (#8851)
3901f5f is described below

commit 3901f5f02c882878718dec9e7a90ccdd8aee33c6
Author: Pedro Larroy <928489+lar...@users.noreply.github.com>
AuthorDate: Tue Dec 12 21:44:58 2017 +

Use backtrace from dmlc-core with demangled C++ symbols on segfault (#8851)
---
 CMakeLists.txt|  5 +
 make/config.mk|  2 +-
 src/initialize.cc | 26 ++
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4804793..8211624 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ mxnet_option(USE_MXNET_LIB_NAMING "Use MXNet library naming 
conventions." ON)
 mxnet_option(USE_GPROF"Compile with gprof (profiling) flag" OFF)
 mxnet_option(USE_VTUNE"Enable use of Intel Amplifier XE (VTune)" 
OFF) # one could set VTUNE_ROOT for search path
 mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF)
+mxnet_option(USE_SIGNAL_HANDLER   "Print stack traces on segfaults." OFF)
 
 
 
@@ -574,6 +575,10 @@ if (INSTALL_EXAMPLES)
   install(DIRECTORY example  DESTINATION 
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
 endif()
 
+if (USE_SIGNAL_HANDLER)
+   add_definitions(-DMXNET_USE_SIGNAL_HANDLER=1)
+endif()
+
 # AUTO_INSTALL_DIR -> Optional: specify post-build install direcory
 if(AUTO_INSTALL_DIR)
   # ---[ Install Includes
diff --git a/make/config.mk b/make/config.mk
index 6db22df..9c6393a 100644
--- a/make/config.mk
+++ b/make/config.mk
@@ -33,7 +33,7 @@ DEBUG = 0
 # whether compile with profiler
 USE_PROFILER =
 
-# whether to turn on signal handler (e.g. segfault logger)
+# whether to turn on segfault signal handler to log the stack trace
 USE_SIGNAL_HANDLER =
 
 # the additional link flags you want to add
diff --git a/src/initialize.cc b/src/initialize.cc
index 56d6fe1..2d077f4 100644
--- a/src/initialize.cc
+++ b/src/initialize.cc
@@ -25,37 +25,23 @@
 #include 
 #include 
 #include 
-
 #include "engine/profiler.h"
 
 namespace mxnet {
-
-void segfault_logger(int sig) {
-  const int MAX_STACK_SIZE = 10;
-  void *stack[MAX_STACK_SIZE];
-
+#if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE
+static void SegfaultLogger(int sig) {
   fprintf(stderr, "\nSegmentation fault: %d\n\n", sig);
-
-#if DMLC_LOG_STACK_TRACE
-  int nframes = backtrace(stack, MAX_STACK_SIZE);
-  fprintf(stderr, "Stack trace returned %d entries:\n", nframes);
-  char **msgs = backtrace_symbols(stack, nframes);
-  if (msgs != nullptr) {
-for (int i = 0; i < nframes; ++i) {
-  fprintf(stderr, "[bt] (%d) %s\n", i, msgs[i]);
-}
-  }
-#endif  // DMLC_LOG_STACK_TRACE
-
+  fprintf(stderr, "%s", dmlc::StackTrace().c_str());
   exit(-1);
 }
+#endif
 
 class LibraryInitializer {
  public:
   LibraryInitializer() {
 dmlc::InitLogging("mxnet");
-#if MXNET_USE_SIGNAL_HANDLER
-signal(SIGSEGV, segfault_logger);
+#if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE
+signal(SIGSEGV, SegfaultLogger);
 #endif
 #if MXNET_USE_PROFILER
 // ensure profiler's constructor are called before atexit.

-- 
To stop receiving notification emails like this one, please contact
['"comm...@mxnet.apache.org" '].


[GitHub] piiswrong closed pull request #8851: Use backtrace from dmlc-core (dmlc::stack_trace())

2017-12-12 Thread GitBox
piiswrong closed pull request #8851: Use backtrace from dmlc-core 
(dmlc::stack_trace())
URL: https://github.com/apache/incubator-mxnet/pull/8851
 
 
   

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 480479333b..8211624a7d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -47,6 +47,7 @@ mxnet_option(USE_MXNET_LIB_NAMING "Use MXNet library naming 
conventions." ON)
 mxnet_option(USE_GPROF"Compile with gprof (profiling) flag" OFF)
 mxnet_option(USE_VTUNE"Enable use of Intel Amplifier XE (VTune)" 
OFF) # one could set VTUNE_ROOT for search path
 mxnet_option(INSTALL_EXAMPLES "Install the example source files." OFF)
+mxnet_option(USE_SIGNAL_HANDLER   "Print stack traces on segfaults." OFF)
 
 
 
@@ -574,6 +575,10 @@ if (INSTALL_EXAMPLES)
   install(DIRECTORY example  DESTINATION 
${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
 endif()
 
+if (USE_SIGNAL_HANDLER)
+   add_definitions(-DMXNET_USE_SIGNAL_HANDLER=1)
+endif()
+
 # AUTO_INSTALL_DIR -> Optional: specify post-build install direcory
 if(AUTO_INSTALL_DIR)
   # ---[ Install Includes
diff --git a/make/config.mk b/make/config.mk
index 6db22df0c8..9c6393a45d 100644
--- a/make/config.mk
+++ b/make/config.mk
@@ -33,7 +33,7 @@ DEBUG = 0
 # whether compile with profiler
 USE_PROFILER =
 
-# whether to turn on signal handler (e.g. segfault logger)
+# whether to turn on segfault signal handler to log the stack trace
 USE_SIGNAL_HANDLER =
 
 # the additional link flags you want to add
diff --git a/src/initialize.cc b/src/initialize.cc
index 56d6fe1fff..2d077f4908 100644
--- a/src/initialize.cc
+++ b/src/initialize.cc
@@ -25,37 +25,23 @@
 #include 
 #include 
 #include 
-
 #include "engine/profiler.h"
 
 namespace mxnet {
-
-void segfault_logger(int sig) {
-  const int MAX_STACK_SIZE = 10;
-  void *stack[MAX_STACK_SIZE];
-
+#if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE
+static void SegfaultLogger(int sig) {
   fprintf(stderr, "\nSegmentation fault: %d\n\n", sig);
-
-#if DMLC_LOG_STACK_TRACE
-  int nframes = backtrace(stack, MAX_STACK_SIZE);
-  fprintf(stderr, "Stack trace returned %d entries:\n", nframes);
-  char **msgs = backtrace_symbols(stack, nframes);
-  if (msgs != nullptr) {
-for (int i = 0; i < nframes; ++i) {
-  fprintf(stderr, "[bt] (%d) %s\n", i, msgs[i]);
-}
-  }
-#endif  // DMLC_LOG_STACK_TRACE
-
+  fprintf(stderr, "%s", dmlc::StackTrace().c_str());
   exit(-1);
 }
+#endif
 
 class LibraryInitializer {
  public:
   LibraryInitializer() {
 dmlc::InitLogging("mxnet");
-#if MXNET_USE_SIGNAL_HANDLER
-signal(SIGSEGV, segfault_logger);
+#if MXNET_USE_SIGNAL_HANDLER && DMLC_LOG_STACK_TRACE
+signal(SIGSEGV, SegfaultLogger);
 #endif
 #if MXNET_USE_PROFILER
 // ensure profiler's constructor are called before atexit.


 


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


With regards,
Apache Git Services


[GitHub] madjam commented on a change in pull request #9008: Usability improvement mxnet vae

2017-12-12 Thread GitBox
madjam commented on a change in pull request #9008: Usability improvement mxnet 
vae
URL: https://github.com/apache/incubator-mxnet/pull/9008#discussion_r156503316
 
 

 ##
 File path: example/mxnet_adversarial_vae/README.md
 ##
 @@ -1,22 +1,55 @@
-VAE-GAN in MXNet
+# VAE-GAN in MXNet
 
-Implementation of Autoencoding beyond pixels using a learned similarity metric 
based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
+* Implementation of Autoencoding beyond pixels using a learned similarity 
metric based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
 
-*Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
+* Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
 
-As the name indicates, VAE-GAN replaces GAN's generator with a variational 
auto-encoder, resulting in a model with both inference and generation 
components. 
+* As the name indicates, VAE-GAN replaces GAN's generator with a variational 
auto-encoder, resulting in a model with both inference and generation 
components. 
 
-Experiements
+# Experiements
 
-Dataset: caltech 101 silhouettes dataset from 
https://people.cs.umass.edu/~marlin/data.shtml
+* Dataset: caltech 101 silhouettes dataset from 
https://people.cs.umass.edu/~marlin/data.shtml
 
-Usage
+# Prerequisites
 
-Using existing models
+* Opencv
+* Python packages required: scipy, scikit-learn and Pillow, opencv python 
package
 
+# Environment Tested On
+
+Ubuntu Deep Learning AMI, p2.8xlarge
 
 Review comment:
   p2.8xlarge running Amazon EC2 Ubuntu Deep Learning AMI // Can you include 
the AMI 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] madjam commented on a change in pull request #9008: Usability improvement mxnet vae

2017-12-12 Thread GitBox
madjam commented on a change in pull request #9008: Usability improvement mxnet 
vae
URL: https://github.com/apache/incubator-mxnet/pull/9008#discussion_r156504457
 
 

 ##
 File path: example/mxnet_adversarial_vae/README.md
 ##
 @@ -1,22 +1,55 @@
-VAE-GAN in MXNet
+# VAE-GAN in MXNet
 
-Implementation of Autoencoding beyond pixels using a learned similarity metric 
based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
 
 Review comment:
   New sentence for: "Based on the Tensorflow implementation ..."


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


With regards,
Apache Git Services


[GitHub] madjam commented on a change in pull request #9008: Usability improvement mxnet vae

2017-12-12 Thread GitBox
madjam commented on a change in pull request #9008: Usability improvement mxnet 
vae
URL: https://github.com/apache/incubator-mxnet/pull/9008#discussion_r156504507
 
 

 ##
 File path: example/mxnet_adversarial_vae/README.md
 ##
 @@ -1,22 +1,55 @@
-VAE-GAN in MXNet
+# VAE-GAN in MXNet
 
-Implementation of Autoencoding beyond pixels using a learned similarity metric 
based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
+* Implementation of Autoencoding beyond pixels using a learned similarity 
metric based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
 
-*Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
+* Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
 
 Review comment:
   details* -> details


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


With regards,
Apache Git Services


[GitHub] madjam commented on a change in pull request #9008: Usability improvement mxnet vae

2017-12-12 Thread GitBox
madjam commented on a change in pull request #9008: Usability improvement mxnet 
vae
URL: https://github.com/apache/incubator-mxnet/pull/9008#discussion_r156504706
 
 

 ##
 File path: example/mxnet_adversarial_vae/README.md
 ##
 @@ -1,22 +1,55 @@
-VAE-GAN in MXNet
+# VAE-GAN in MXNet
 
-Implementation of Autoencoding beyond pixels using a learned similarity metric 
based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
+* Implementation of Autoencoding beyond pixels using a learned similarity 
metric based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
 
-*Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
+* Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
 
-As the name indicates, VAE-GAN replaces GAN's generator with a variational 
auto-encoder, resulting in a model with both inference and generation 
components. 
+* As the name indicates, VAE-GAN replaces GAN's generator with a variational 
auto-encoder, resulting in a model with both inference and generation 
components. 
 
-Experiements
+# Experiements
 
-Dataset: caltech 101 silhouettes dataset from 
https://people.cs.umass.edu/~marlin/data.shtml
+* Dataset: caltech 101 silhouettes dataset from 
https://people.cs.umass.edu/~marlin/data.shtml
 
-Usage
+# Prerequisites
 
-Using existing models
+* Opencv
+* Python packages required: scipy, scikit-learn and Pillow, opencv python 
package
 
+# Environment Tested On
+
+Ubuntu Deep Learning AMI, p2.8xlarge
 
 Review comment:
   Amazon EC2 p2.8xlarge running Ubuntu DeepLearning AMI // can you add 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] madjam commented on a change in pull request #9008: Usability improvement mxnet vae

2017-12-12 Thread GitBox
madjam commented on a change in pull request #9008: Usability improvement mxnet 
vae
URL: https://github.com/apache/incubator-mxnet/pull/9008#discussion_r156502867
 
 

 ##
 File path: example/mxnet_adversarial_vae/README.md
 ##
 @@ -1,22 +1,55 @@
-VAE-GAN in MXNet
+# VAE-GAN in MXNet
 
-Implementation of Autoencoding beyond pixels using a learned similarity metric 
based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
+* Implementation of Autoencoding beyond pixels using a learned similarity 
metric based on the Tensorflow implementation of 
https://github.com/JeremyCCHsu/tf-vaegan/
 
-*Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
+* Please refer to their official Github for details*: 
https://github.com/andersbll/autoencoding_beyond_pixels
 
 Review comment:
   details* -> details


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #9020: pooling of dcnn

2017-12-12 Thread GitBox
eric-haibin-lin commented on issue #9020: pooling of dcnn
URL: 
https://github.com/apache/incubator-mxnet/issues/9020#issuecomment-351206480
 
 
   Agreed that the original paper uses global pooling. Was it a bug in the 
example or it was by any chance "intentional simplification"?  @qcl6355  


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7856: add missing cuda libs to LDFLAGS

2017-12-12 Thread GitBox
piiswrong commented on issue #7856: add missing cuda libs to LDFLAGS
URL: https://github.com/apache/incubator-mxnet/pull/7856#issuecomment-351207174
 
 
   closing as this doesn't seem to be necessary


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7856: add missing cuda libs to LDFLAGS

2017-12-12 Thread GitBox
piiswrong closed pull request #7856: add missing cuda libs to LDFLAGS
URL: https://github.com/apache/incubator-mxnet/pull/7856
 
 
   

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/Makefile b/Makefile
index 54df33f185..0be8d508e2 100644
--- a/Makefile
+++ b/Makefile
@@ -54,6 +54,9 @@ include $(DMLC_CORE)/make/dmlc.mk
 WARNFLAGS= -Wall -Wsign-compare
 CFLAGS = -DMSHADOW_FORCE_STREAM $(WARNFLAGS)
 
+# check undefined symbol
+LDFLAGS = -Wl,--no-undefined
+
 ifeq ($(DEV), 1)
CFLAGS += -g -Werror
NVCCFLAGS += -Werror cross-execution-space-call
@@ -66,7 +69,7 @@ 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)
-LDFLAGS = -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
+LDFLAGS += -pthread $(MSHADOW_LDFLAGS) $(DMLC_LDFLAGS)
 ifeq ($(DEBUG), 1)
NVCCFLAGS += -std=c++11 -Xcompiler -D_FORCE_INLINES -g -G -O0 -ccbin 
$(CXX) $(MSHADOW_NVCCFLAGS)
 else
@@ -272,7 +275,7 @@ ALL_DEP = $(OBJ) $(EXTRA_OBJ) $(PLUGIN_OBJ) $(LIB_DEP)
 ifeq ($(USE_CUDA), 1)
CFLAGS += -I$(ROOTDIR)/cub
ALL_DEP += $(CUOBJ) $(EXTRA_CUOBJ) $(PLUGIN_CUOBJ)
-   LDFLAGS += -lcuda -lcufft
+   LDFLAGS += -lcuda -lcufft -lcublas -lcusolver -lcurand -lcudart
SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-gpu
 else
SCALA_PKG_PROFILE := $(SCALA_PKG_PROFILE)-cpu


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #6496: Add hinge loss for svm

2017-12-12 Thread GitBox
piiswrong commented on issue #6496: Add hinge loss for svm
URL: https://github.com/apache/incubator-mxnet/pull/6496#issuecomment-351207393
 
 
   closing due to inactive. Please reopen after addressing comments


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #6496: Add hinge loss for svm

2017-12-12 Thread GitBox
piiswrong closed pull request #6496: Add hinge loss for svm
URL: https://github.com/apache/incubator-mxnet/pull/6496
 
 
   

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/metric.py b/python/mxnet/metric.py
index c57f12fc5d..fb91c30cdb 100644
--- a/python/mxnet/metric.py
+++ b/python/mxnet/metric.py
@@ -941,6 +941,70 @@ def __init__(self, name='caffe',
 name, output_names=output_names, label_names=label_names)
 
 
+@register
+class HingeLoss(EvalMetric):
+"""Computes Hinge loss for SVM.
+
+The hinge loss for one example:
+
+.. math::
+\\L_i={\sum_{j\neq y_i}max(0, w_j^Tx_i-w_{y_i}^Tx_i+margin)}
+
+Parameters
+--
+name : str
+Name of this metric instance for display.
+use_linear : boolean, Optional
+Whether to use L1-regularized objective (the default is False).
+margin : float, Optional
+Margin for the SVM (the default is 1.0).
+output_names : list of str, or None
+Name of predictions that should be used when updating with update_dict.
+By default include all predictions.
+label_names : list of str, or None
+Name of labels that should be used when updating with update_dict.
+By default include all labels.
+
+Examples
+
+>>> predicts = [mx.nd.array(np.array([-1.73, -1.24, 0.89, -0.99, 
0.05]).reshape(1, -1))]
+>>> labels = [mx.nd.array(np.array([2]))]
+>>> hinge_loss_l1 = mx.metric.HingeLoss(use_linear=True)
+>>> hinge_loss_l1.update(labels = labels, preds = predicts)
+>>> print hinge_loss_l1.get()
+('hinge_loss', 0.160262260437)
+>>> hinge_loss_l2 = mx.metric.HingeLoss()
+>>> hinge_loss_l2.update(labels = labels, preds = predicts)
+>>> print hinge_loss_l2.get()
+('hinge_loss', 0.0256866651535)
+"""
+def __init__(self, name='hinge_loss', use_linear=False, margin=1.0,
+ output_names=None, label_names=None):
+super(HingeLoss, self).__init__(
+name, output_names=output_names, label_names=label_names)
+self.use_linear = use_linear
+self.margin = margin
+
+def norm(self, x):
+return x if self.use_linear else x**2.0
+
+def update(self, labels, preds):
+check_label_shapes(labels, preds)
+
+for label, pred in zip(labels, preds):
+n = label.shape[0]
+pred = pred.asnumpy()
+label = label.asnumpy().astype('int32')
+
+pred = pred - pred[numpy.arange(n), label].reshape(-1, 1) + 
self.margin
+pred[numpy.arange(n), label] = 0
+
+loss = numpy.maximum(0, pred)
+
+self.sum_metric += numpy.sum(self.norm(loss))
+self.num_inst += n
+
+
 @register
 class CustomMetric(EvalMetric):
 """Computes a customized evaluation metric.


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7938: instance norm and reflection padding

2017-12-12 Thread GitBox
piiswrong commented on issue #7938: instance norm and reflection padding
URL: https://github.com/apache/incubator-mxnet/pull/7938#issuecomment-351207795
 
 
   @szha The original author seems to have disappeared. Would you like to take 
over?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7898: Stop the build if there are Python syntax errors

2017-12-12 Thread GitBox
piiswrong commented on issue #7898: Stop the build if there are Python syntax 
errors
URL: https://github.com/apache/incubator-mxnet/pull/7898#issuecomment-351207891
 
 
   closing since travis is not used anymore


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7984: Update parse_log.py

2017-12-12 Thread GitBox
piiswrong commented on issue #7984: Update parse_log.py
URL: https://github.com/apache/incubator-mxnet/pull/7984#issuecomment-351208407
 
 
   @mli Could you have a look?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7984: Update parse_log.py

2017-12-12 Thread GitBox
piiswrong closed pull request #7984: Update parse_log.py
URL: https://github.com/apache/incubator-mxnet/pull/7984
 
 
   

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/tools/parse_log.py b/tools/parse_log.py
index f0ce53dbe7..ca7ad195cb 100755
--- a/tools/parse_log.py
+++ b/tools/parse_log.py
@@ -35,9 +35,19 @@
 with open(args.logfile[0]) as f:
 lines = f.readlines()
 
-res = [re.compile('.*Epoch\[(\d+)\] Train.*=([.\d]+)'),
-   re.compile('.*Epoch\[(\d+)\] Valid.*=([.\d]+)'),
-   re.compile('.*Epoch\[(\d+)\] Time.*=([.\d]+)')]
+if 'top_k' in ''.join(lines):
+has_top_k = True
+res = [re.compile('.*Epoch\[(\d+)\] Train-accuracy=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Train-top_k_accuracy.*=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Validation-accuracy=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Validation-top_k_accuracy.*=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Time.*=([.\d]+)')]
+
+else:
+has_top_k = False
+res = [re.compile('.*Epoch\[(\d+)\] Train-accuracy=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Validation-accuracy=([.\d]+)'),
+re.compile('.*Epoch\[(\d+)\] Time.*=([.\d]+)')]
 
 data = {}
 for l in lines:
@@ -61,11 +71,23 @@
 data[epoch][i*2+1] += 1
 
 if args.format == 'markdown':
-print "| epoch | train-accuracy | valid-accuracy | time |"
-print "| --- | --- | --- | --- |"
-for k, v in data.items():
-print "| %2d | %f | %f | %.1f |" % (k+1, v[0]/v[1], v[2]/v[3], 
v[4]/v[5])
+if has_top_k:
+print "| epoch | train-accuracy | train-top_k_accuracy | 
validation-accuracy | validation-top_k_accuracy | time |"
+print "| --- | --- | --- | --- | --- | --- |"
+for k, v in data.items():
+print "| %2d | %f | %f | %f | %f | %.1f |" % (k+1, v[0]/v[1], 
v[2]/v[3], v[4]/v[5], v[6]/v[7], v[8]/v[9])
+else:
+print "| epoch | train-accuracy | valid-accuracy | time |"
+print "| --- | --- | --- | --- |"
+for k, v in data.items():
+print "| %2d | %f | %f | %.1f |" % (k+1, v[0]/v[1], v[2]/v[3], 
v[4]/v[5])
 elif args.format == 'none':
-print "epoch\ttrain-accuracy\tvalid-accuracy\ttime"
-for k, v in data.items():
-print "%2d\t%f\t%f\t%.1f" % (k+1, v[0]/v[1], v[2]/v[3], v[4]/v[5])
+if has_top_k:
+print 
"epoch\ttrain-accuracy\ttrain-top_k_accuracy\tvalid-accuracy\tvalid-top_k_accuracy\ttime"
+for k, v in data.items():
+print "%2d\t%f\t%f\t%f\t%f\t%.1f" % (k+1, v[0]/v[1], v[2]/v[3], 
v[4]/v[5], v[6]/v[7], v[8]/v[9])
+
+else:
+print "epoch\ttrain-accuracy\tvalid-accuracy\ttime"
+for k, v in data.items():
+print "%2d\t%f\t%f\t%.1f" % (k+1, v[0]/v[1], v[2]/v[3], v[4]/v[5])


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8027: Optional reshape of predictions in Perplexity metric

2017-12-12 Thread GitBox
piiswrong commented on issue #8027: Optional reshape of predictions in 
Perplexity metric
URL: https://github.com/apache/incubator-mxnet/pull/8027#issuecomment-351208732
 
 
   @reminisce Could you take over? I think @zackchase complained about metric 
speed


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7944: Update softmax_output.cc

2017-12-12 Thread GitBox
piiswrong closed pull request #7944: Update softmax_output.cc
URL: https://github.com/apache/incubator-mxnet/pull/7944
 
 
   

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/softmax_output.cc b/src/operator/softmax_output.cc
index 52bb2a4007..82e3437ad5 100644
--- a/src/operator/softmax_output.cc
+++ b/src/operator/softmax_output.cc
@@ -44,13 +44,13 @@ Operator *SoftmaxOutputProp::CreateOperatorEx(Context ctx, 
std::vector *
 DMLC_REGISTER_PARAMETER(SoftmaxOutputParam);
 
 MXNET_REGISTER_OP_PROPERTY(SoftmaxOutput, SoftmaxOutputProp)
-.describe(R"code(Computes the gradient of cross entropy loss with respect to 
softmax output.
+.describe(R"code(Computes the gradient of cross entropy loss with respect to 
the input array `data`.
 
 - This operator computes the gradient in two steps.
   The cross entropy loss does not actually need to be computed.
 
   - Applies softmax function on the input array.
-  - Computes and returns the gradient of cross entropy loss w.r.t. the softmax 
output.
+  - Computes and returns the gradient of cross entropy loss w.r.t. the input 
array.
 
 - The softmax function, cross entropy loss and gradient is given by:
 
@@ -62,7 +62,7 @@ MXNET_REGISTER_OP_PROPERTY(SoftmaxOutput, SoftmaxOutputProp)
 
 .. math:: \text{CE(label, output)} = - \sum_i \text{label}_i 
\log(\text{output}_i)
 
-  - The gradient of cross entropy loss w.r.t softmax output:
+  - The gradient of cross entropy loss w.r.t the input array:
 
 .. math:: \text{gradient} = \text{output} - \text{label}
 
@@ -81,7 +81,7 @@ MXNET_REGISTER_OP_PROPERTY(SoftmaxOutput, SoftmaxOutputProp)
   - If `multi_output` is ``true``, the softmax function will be computed along
 the second axis (`axis` = ``1``).
 
-- During backward propagation, the gradient of cross-entropy loss w.r.t 
softmax output array is computed.
+- During backward propagation, the gradient of cross-entropy loss w.r.t the 
input array is computed.
   The provided label can be a one-hot label array or a probability label array.
 
   - If the parameter `use_ignore` is ``true``, `ignore_label` can specify 
input instances


 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7944: Update softmax_output.cc

2017-12-12 Thread GitBox
piiswrong commented on issue #7944: Update softmax_output.cc
URL: https://github.com/apache/incubator-mxnet/pull/7944#issuecomment-351208883
 
 
   closing due to inactive


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7809: open dlpack in windows

2017-12-12 Thread GitBox
piiswrong commented on issue #7809: open dlpack in windows
URL: https://github.com/apache/incubator-mxnet/pull/7809#issuecomment-351208946
 
 
   closing due to inactive


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7809: open dlpack in windows

2017-12-12 Thread GitBox
piiswrong closed pull request #7809: open dlpack in windows
URL: https://github.com/apache/incubator-mxnet/pull/7809
 
 
   

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 c20759cc35..6200c0e43e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -14,7 +14,11 @@ mxnet_option(USE_OPENCV   "Build with OpenCV 
support" ON)
 mxnet_option(USE_OPENMP   "Build with Openmp support" ON)
 mxnet_option(USE_CUDA "Build with CUDA support"   ON)
 mxnet_option(USE_CUDNN"Build with cudnn support"  ON) # one could 
set CUDNN_ROOT for search path
-mxnet_option(USE_LAPACK   "Build with lapack support" ON IF NOT MSVC)
+if(MSVC)
+mxnet_option(USE_LAPACK   "Build with lapack support" OFF)
+else()
+mxnet_option(USE_LAPACK   "Build with lapack support" ON)
+endif()
 mxnet_option(USE_MKL_IF_AVAILABLE "Use MKL if found" ON)
 mxnet_option(USE_MKLML_MKL"Use MKLML variant of MKL (if MKL found)" ON 
IF USE_MKL_IF_AVAILABLE AND UNIX AND (NOT APPLE))
 mxnet_option(USE_MKL_EXPERIMENTAL "Use experimental MKL (if MKL enabled and 
found)" OFF)
@@ -209,11 +213,15 @@ elseif(UNIX)
 endif()
 
 if(USE_LAPACK)
-  add_definitions(-DMXNET_USE_LAPACK=1)
-  list(APPEND mxnet_LINKER_LIBS lapack)
+  if(BLAS STREQUAL "Open" OR BLAS STREQUAL "open")
+add_definitions(-DMXNET_USE_LAPACK=1)
+  elseif()
+find_package(LAPACK REQUIRED)
+add_definitions(-DMXNET_USE_LAPACK=1)
+list(APPEND mxnet_LINKER_LIBS ${LAPACK_LIB})
+  endif()
 else(USE_LAPACK)
-  # Workaround for Windows until using new Jenkinsfile.
-  if(USE_BLAS STREQUAL "open")
+  if(BLAS STREQUAL "Open" OR BLAS STREQUAL "open")
 add_definitions(-DMXNET_USE_LAPACK=1)
   endif()
 endif()
diff --git a/cmake/Modules/FindLAPACK.cmake b/cmake/Modules/FindLAPACK.cmake
new file mode 100644
index 00..a36b22c0a2
--- /dev/null
+++ b/cmake/Modules/FindLAPACK.cmake
@@ -0,0 +1,84 @@
+# 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(TO_CMAKE_PATH "$ENV{LAPACK_HOME}" LAPACK_HOME)
+file(TO_CMAKE_PATH "$ENV{LAPACK}" LAPACK_DIR)
+
+SET(LAPACK_INCLUDE_SEARCH_PATHS
+  /usr/include
+  /usr/include/LAPACK
+  /usr/include/LAPACK-base
+  /usr/local/include
+  /usr/local/include/LAPACK
+  /usr/local/include/LAPACK-base
+  /opt/LAPACK/include
+  /usr/local/opt/LAPACK/include
+  ${PROJECT_SOURCE_DIR}/3rdparty/LAPACK/include
+  ${PROJECT_SOURCE_DIR}/thirdparty/LAPACK/include
+  ${LAPACK_HOME}
+  ${LAPACK_HOME}/include
+)
+
+SET(LAPACK_LIB_SEARCH_PATHS
+/lib/
+/lib/LAPACK-base
+/lib64/
+/usr/lib
+/usr/lib/LAPACK-base
+/usr/lib64
+/usr/local/lib
+/usr/local/lib64
+/opt/LAPACK/lib
+/usr/local/opt/LAPACK/lib
+${PROJECT_SOURCE_DIR}/3rdparty/LAPACK/lib
+${PROJECT_SOURCE_DIR}/thirdparty/LAPACK/lib
+${LAPACK_DIR}
+${LAPACK_DIR}/lib
+${LAPACK_HOME}
+${LAPACK_HOME}/lib
+ )
+
+#FIND_PATH(LAPACK_INCLUDE_DIR NAMES cblas.h PATHS 
${LAPACK_INCLUDE_SEARCH_PATHS})
+FIND_LIBRARY(LAPACK_LIB NAMES lapack PATHS ${LAPACK_LIB_SEARCH_PATHS})
+IF(NOT LAPACK_LIB)
+   FIND_FILE(LAPACK_LIB NAMES liblapack.dll.a PATHS 
${LAPACK_LIB_SEARCH_PATHS})
+ENDIF()
+
+SET(LAPACK_FOUND ON)
+
+#Check libraries
+IF(NOT LAPACK_LIB)
+SET(LAPACK_FOUND OFF)
+MESSAGE(STATUS "Could not find LAPACK lib. Turning LAPACK_FOUND off")
+ENDIF()
+
+IF (LAPACK_FOUND)
+  IF (NOT LAPACK_FIND_QUIETLY)
+MESSAGE(STATUS "Found LAPACK libraries: ${LAPACK_LIB}")
+  ENDIF (NOT LAPACK_FIND_QUIETLY)
+ELSE (LAPACK_FOUND)
+  IF (LAPACK_FIND_REQUIRED)
+MESSAGE(FATAL_ERROR "Could not find LAPACK")
+  ENDIF (LAPACK_FIND_REQUIRED)
+ENDIF (LAPACK_FOUND)
+
+MARK_AS_ADVANCED(
+LAPACK_INCLUDE_DIR
+LAPACK_LIB
+LAPACK
+)
+
diff --git a/cmake/Modules/FindOpenBLAS.cmake b/cmake/Modules/FindOpenBLAS.cmake
index 7c5272b7f7..150b2ad41a 100644
--- a/cmake/Modules/FindOpenBLAS.cmake
+++ b/cmake/Modules/FindOpenBLAS.cmake
@@ -49,8 +49,8 @@ 

[GitHub] piiswrong closed pull request #6586: Implementation for concat relu operator

2017-12-12 Thread GitBox
piiswrong closed pull request #6586: Implementation for concat relu operator
URL: https://github.com/apache/incubator-mxnet/pull/6586
 
 
   

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/contrib/crelu-inl.h b/src/operator/contrib/crelu-inl.h
new file mode 100644
index 00..d764658dd8
--- /dev/null
+++ b/src/operator/contrib/crelu-inl.h
@@ -0,0 +1,185 @@
+
+/*!
+ * Copyright (c) 2017 by Contributors
+ * \file crelu-inl.h
+ * \brief concat relu
+ * \author Yijie Zhuang
+*/
+
+#ifndef MXNET_OPERATOR_CONTRIB_CRELU_INL_H_
+#define MXNET_OPERATOR_CONTRIB_CRELU_INL_H_
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "../operator_common.h"
+#include "../channel_op_common.h"
+#include "../mshadow_op.h"
+
+namespace mxnet {
+namespace op {
+
+namespace concat_relu {
+enum CReluOpInputs {kData};
+enum CReluOpResource {kTempSpace};
+enum CReluOpOutputs {kOut};
+}
+
+struct CReluParam : public dmlc::Parameter {
+  DMLC_DECLARE_PARAMETER(CReluParam) {}
+};
+
+template
+class CReluOp : public Operator {
+ public:
+  explicit CReluOp(CReluParam p) { this->param_ = p; }
+
+  virtual void Forward(const OpContext ,
+   const std::vector _data,
+   const std::vector ,
+   const std::vector _data,
+   const std::vector _args) {
+using namespace mshadow;
+using namespace mshadow::expr;
+CHECK_EQ(in_data.size(), 1U);
+CHECK_EQ(out_data.size(), 1U);
+Stream *s = ctx.get_stream();
+
+Tensor data = in_data[concat_relu::kData].FlatTo2D(s);
+Tensor out = out_data[concat_relu::kOut].FlatTo2D(s);
+std::vector > concat_data(2);
+
+concat_data[0] = Tensor(out.dptr_, data.shape_, s);
+concat_data[1] = ctx.requested[concat_relu::kTempSpace]
+.get_space_typed(data.shape_, s);
+
+concat_data[0] = F(data);
+concat_data[1] = F(F(data));
+
+Concatenate(concat_data, , 1, req[concat_relu::kOut]);
+  }
+
+  virtual void Backward(const OpContext ,
+const std::vector _grad,
+const std::vector _data,
+const std::vector _data,
+const std::vector ,
+const std::vector _grad,
+const std::vector _args) {
+using namespace mshadow;
+using namespace mshadow::expr;
+CHECK_EQ(out_grad.size(), 1U);
+CHECK(in_data.size() == 1 && in_grad.size() == 1);
+CHECK_EQ(req.size(), 1U);
+Stream *s = ctx.get_stream();
+
+using namespace std;
+
+Tensor m_in_grad = 
in_grad[concat_relu::kData].FlatTo2D(s);
+Tensor m_in_data = 
in_data[concat_relu::kData].FlatTo2D(s);
+Tensor m_out_grad = 
out_grad[concat_relu::kOut].FlatTo2D(s);
+Tensor m_out_data = 
out_data[concat_relu::kOut].FlatTo2D(s);
+
+m_out_grad = F(m_out_data) * m_out_grad;
+
+Assign(m_in_grad, req[concat_relu::kData], slice<1>(m_out_grad, 0, 
m_out_grad.size(1)/2)
+* F(m_in_data)
++ slice<1>(m_out_grad, m_out_grad.size(1)/2, 
m_out_grad.size(1))
+* F(m_in_data));
+  }
+
+ private:
+CReluParam param_;
+};  // class crelu
+
+// Decalre Factory function, used for dispatch specialization
+template
+Operator* CreateOp(CReluParam param, int dtype);
+
+#if DMLC_USE_CXX11
+class CReluProp : public OperatorProperty {
+ public:
+  void Init(const std::vector >& kwargs) 
override {
+param_.Init(kwargs);
+  }
+
+  std::map GetParams() const override {
+return param_.__DICT__();
+  }
+
+  bool InferShape(std::vector *in_shape,
+  std::vector *out_shape,
+  std::vector *aux_shape) const override {
+using namespace mshadow;
+CHECK_EQ(in_shape->size(), 1U) << "Input:[data]";
+TShape dshape = in_shape->at(concat_relu::kData);
+if (dshape.ndim() == 0) return false;
+dshape[dshape.ndim()-1] = dshape[dshape.ndim()-1] * 2;
+out_shape->clear();
+out_shape->push_back(dshape);
+return true;
+  }
+
+  bool InferType(std::vector *in_type,
+ std::vector *out_type,
+ std::vector *aux_type) const override {
+CHECK_GE(in_type->size(), 1U);
+int dtype = (*in_type)[0];
+CHECK_NE(dtype, -1) << "First input must have specified type";
+for (index_t i = 0; i < in_type->size(); ++i) {
+  if ((*in_type)[i] == -1) {
+  

[GitHub] piiswrong commented on issue #6586: Implementation for concat relu operator

2017-12-12 Thread GitBox
piiswrong commented on issue #6586: Implementation for concat relu operator
URL: https://github.com/apache/incubator-mxnet/pull/6586#issuecomment-351209237
 
 
   closing due to inactive


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7772: Use memcopy instead of assigning each individual element

2017-12-12 Thread GitBox
piiswrong closed pull request #7772: Use memcopy instead of assigning each 
individual element
URL: https://github.com/apache/incubator-mxnet/pull/7772
 
 
   

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/include/mxnet/base.h b/include/mxnet/base.h
index 61d105a5bc..6f08630792 100644
--- a/include/mxnet/base.h
+++ b/include/mxnet/base.h
@@ -49,6 +49,15 @@
 #define MXNET_USE_CUDA MSHADOW_USE_CUDA
 #endif
 
+/*!
+ *\brief whether to use __builtin_memcpy or not
+ */
+#ifdef MXNET_USE_BUILTIN_MEMCPY
+#define MXNET_MEMCPY __builtin_memcpy
+#else
+#define MXNET_MEMCPY memcpy
+#endif
+
 /*!
  *\brief whether to use cudnn library for convolution
  */
diff --git a/src/operator/contrib/proposal.cc b/src/operator/contrib/proposal.cc
index ccb541a403..1aa51fde18 100644
--- a/src/operator/contrib/proposal.cc
+++ b/src/operator/contrib/proposal.cc
@@ -341,7 +341,7 @@ class ProposalOp : public Operator{
param_.ratios,
param_.scales,
);
-std::memcpy(workspace_proposals.dptr_, [0], sizeof(float) * 
anchors.size());
+MXNET_MEMCPY(workspace_proposals.dptr_, [0], sizeof(float) * 
anchors.size());
 
 // Enumerate all shifted anchors
 for (index_t i = 0; i < static_cast(num_anchors); ++i) {
diff --git a/src/operator/tensor/cast_storage-inl.h 
b/src/operator/tensor/cast_storage-inl.h
index acb30a9eff..c7479f6c08 100644
--- a/src/operator/tensor/cast_storage-inl.h
+++ b/src/operator/tensor/cast_storage-inl.h
@@ -108,7 +108,6 @@ inline void CastStorageDnsRspImpl(const OpContext& ctx,
   });
 }
 
-// TODO(haibin) Use memcopy instead will be much faster than assigning each 
individual element
 struct CastStorageRspDnsKernel {
   template
   MSHADOW_XINLINE static void Map(int i,
@@ -120,9 +119,13 @@ struct CastStorageRspDnsKernel {
 IType rid = idx[i];
 dim_t dns_offset = rid * row_length;
 dim_t rsp_offset = i * row_length;
-for (dim_t col = 0; col < row_length; col++) {
-  dns[dns_offset + col] = data[rsp_offset + col];
-}
+#if defined(__CUDACC__)
+  for (dim_t col = 0; col < row_length; col++) {
+dns[dns_offset + col] = data[rsp_offset + col];
+  }
+#else
+  MXNET_MEMCPY(dns + dns_offset, data + rsp_offset, sizeof(DType) * 
row_length);
+#endif
   }
 };
 
diff --git a/src/operator/tensor/matrix_op-inl.h 
b/src/operator/tensor/matrix_op-inl.h
index 4654b37ab2..a740823aaa 100644
--- a/src/operator/tensor/matrix_op-inl.h
+++ b/src/operator/tensor/matrix_op-inl.h
@@ -552,8 +552,8 @@ void SliceCsrImpl(const SliceParam , const OpContext& 
ctx,
 auto out_data = out.data().dptr();
 int offset = in_indptr[begin];
 // this is also a CPU-only implementation
-memcpy(out_idx, in_idx + offset, nnz * sizeof(IType));
-memcpy(out_data, in_data + offset, nnz * sizeof(DType));
+MXNET_MEMCPY(out_idx, in_idx + offset, nnz * sizeof(IType));
+MXNET_MEMCPY(out_data, in_data + offset, nnz * sizeof(DType));
   });
 });
   });


 


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


With regards,
Apache Git Services


[GitHub] zheng-da commented on a change in pull request #8302: Refactor operators & MKLDNN

2017-12-12 Thread GitBox
zheng-da commented on a change in pull request #8302: Refactor operators & 
MKLDNN
URL: https://github.com/apache/incubator-mxnet/pull/8302#discussion_r156508822
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -95,12 +319,36 @@ NDArray NDArray::ReshapeWithRecord(const TShape ) {
   return ret;
 }
 
-
 NDArray NDArray::Slice(index_t begin, index_t end) const {
   CHECK(!is_none()) << "NDArray is empty";
   CHECK_LE(begin, end)
   << "Invalid slicing range [" << begin << ", " << end << ")";
   CHECK_GE(shape_[0], end) << "Slice end index out of range";
+#if MXNET_USE_MKLDNN == 1
+  CHECK(storage_type() == kDefaultStorage || storage_type() == kMKLDNNStorage);
 
 Review comment:
   Slice doesn't work on sparse arrays.


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


With regards,
Apache Git Services


[GitHub] arshitgupta opened a new issue #9042: Avoiding weight sharing among certain layers in BucketingModule?

2017-12-12 Thread GitBox
arshitgupta opened a new issue #9042: Avoiding weight sharing among certain 
layers in BucketingModule?
URL: https://github.com/apache/incubator-mxnet/issues/9042
 
 
   I am using BucketingModule for training multiple small models/bots together. 
Here, the bucket key is bot_id. However, each bot has separate set of target 
labels/classes (and hence, different size of softmax layer for each bot). 
   Is there any way to train such a model in mxnet, where I want to share the 
weights for all the layers but one (softmax) among all the bots? 
   How would I initialize such a model using sym_gen method?
If in the sym_gen method, in the Softmax layer I specify the 
num_hidden=size_dict[bot] i.e., 
   pred = mx.sym.FullyConnected(data=pred, num_hidden=len(size_dict[bot]), 
name='pred')
   pred = mx.sym.SoftmaxOutput(data=pred, label=label, name='softmax')
   I get the error:
   "Inferred shape does not match shared_exec.arg_array's shape" which makes 
sense as each bot has different size.


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


With regards,
Apache Git Services


[GitHub] piiswrong commented on issue #8161: Creating sim-link to raw1394 file

2017-12-12 Thread GitBox
piiswrong commented on issue #8161: Creating sim-link to raw1394 file
URL: https://github.com/apache/incubator-mxnet/pull/8161#issuecomment-351210144
 
 
   closing due to outdated


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8161: Creating sim-link to raw1394 file

2017-12-12 Thread GitBox
piiswrong closed pull request #8161: Creating sim-link to raw1394 file
URL: https://github.com/apache/incubator-mxnet/pull/8161
 
 
   

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/tests/ci_build/Dockerfile.caffe_gpu 
b/tests/ci_build/Dockerfile.caffe_gpu
index 4f6522dab8..dddfb110b4 100644
--- a/tests/ci_build/Dockerfile.caffe_gpu
+++ b/tests/ci_build/Dockerfile.caffe_gpu
@@ -23,3 +23,5 @@ RUN cd caffe; make all pycaffe -j$(nproc)
 RUN cd caffe/python; for req in $(cat requirements.txt); do pip2 install $req; 
done
 
 ENV PYTHONPATH=${PYTHONPATH}:/caffe/python
+
+RUN ln /dev/null /dev/raw1394
diff --git a/tests/ci_build/Dockerfile.gpu b/tests/ci_build/Dockerfile.gpu
index a2893a9fb4..fa215bea00 100644
--- a/tests/ci_build/Dockerfile.gpu
+++ b/tests/ci_build/Dockerfile.gpu
@@ -10,3 +10,8 @@ COPY install/ubuntu_install_r.sh /install/
 RUN /install/ubuntu_install_r.sh
 COPY install/ubuntu_install_perl.sh /install/
 RUN /install/ubuntu_install_perl.sh
+# Note: ln -s /dev/null /dev/raw1394 is to prevent error on python's
+#   cv2 during import: "libdc1394 error: Failed to initialize libdc1394"
+#   So, if you want to run another command, just update your CMD to start
+#   with this script, followed by whatever you want. (Not cute, but works)
+RUN ln /dev/null /dev/raw1394
diff --git a/tests/ci_build/Dockerfile.mklml_gpu 
b/tests/ci_build/Dockerfile.mklml_gpu
index 36f51c2f13..cdef9d6bd9 100644
--- a/tests/ci_build/Dockerfile.mklml_gpu
+++ b/tests/ci_build/Dockerfile.mklml_gpu
@@ -13,3 +13,9 @@ RUN wget --no-check-certificate -O /tmp/mklml.tgz 
https://github.com/01org/mkl-d
 RUN tar -zxvf /tmp/mklml.tgz && cp -rf mklml_*/* /usr/local/ && rm -rf mklml_*
 
 ENV LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/lib
+
+# Note: ln -s /dev/null /dev/raw1394 is to prevent error on python's
+#   cv2 during import: "libdc1394 error: Failed to initialize libdc1394"
+#   So, if you want to run another command, just update your CMD to start
+#   with this script, followed by whatever you want. (Not cute, but works)
+RUN ln /dev/null /dev/raw1394
diff --git a/tests/ci_build/Dockerfile.ubuntu1404_cuda75_cudnn5 
b/tests/ci_build/Dockerfile.ubuntu1404_cuda75_cudnn5
index 88fd7cea6f..334ec80c22 100644
--- a/tests/ci_build/Dockerfile.ubuntu1404_cuda75_cudnn5
+++ b/tests/ci_build/Dockerfile.ubuntu1404_cuda75_cudnn5
@@ -38,3 +38,9 @@ RUN add-apt-repository -y ppa:marutter/rdev
 RUN apt-get update && apt-get -y upgrade
 RUN DEBIAN_FRONTEND=noninteractive apt-get -y -o 
Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install 
r-base r-base-dev
 RUN Rscript -e "install.packages('devtools', repo = 
'https://cran.rstudio.com')"
+
+# Note: ln -s /dev/null /dev/raw1394 is to prevent error on python's
+#   cv2 during import: "libdc1394 error: Failed to initialize libdc1394"
+#   So, if you want to run another command, just update your CMD to start
+#   with this script, followed by whatever you want. (Not cute, but works)
+RUN ln /dev/null /dev/raw1394


 


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


With regards,
Apache Git Services


[GitHub] zheng-da commented on a change in pull request #8302: Refactor operators & MKLDNN

2017-12-12 Thread GitBox
zheng-da commented on a change in pull request #8302: Refactor operators & 
MKLDNN
URL: https://github.com/apache/incubator-mxnet/pull/8302#discussion_r156509390
 
 

 ##
 File path: src/operator/nn/activation-inl.h
 ##
 @@ -61,158 +62,127 @@ struct ActivationParam : public 
dmlc::Parameter {
   }
 };
 
-/**
- * \brief This is the implementation of activation operator.
- * \tparam xpu The device that the op will be executed on.
- */
 template
-class ActivationOp : public Operator {
- public:
-  virtual void Forward(const OpContext ,
-   const std::vector _data,
-   const std::vector ,
-   const std::vector _data,
-   const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
-CHECK_EQ(in_data.size(), 1U);
-CHECK_EQ(out_data.size(), 1U);
-Stream *s = ctx.get_stream();
-const TBlob& input = in_data[activation::kData];
-const size_t sz = input.shape_.Size();
-if (sz) {
-  MXNET_ASSIGN_REQ_SWITCH(req[activation::kOut], Req, {
-mxnet_op::Kernel, xpu>::Launch(
-  s, sz,
-  out_data[activation::kOut].dptr(),
-  input.dptr());
-  });
-}
+void ActivationForward(const OpContext , const TBlob _data,
+   const OpReqType , const TBlob _data) {
+  using namespace mshadow;
+  using namespace mshadow::expr;
+  Stream *s = ctx.get_stream();
+  const size_t sz = in_data.shape_.Size();
+  if (sz) {
+MXNET_ASSIGN_REQ_SWITCH(req, Req, {
+  mxnet_op::Kernel, xpu>::Launch(
+s, sz,
+out_data.dptr(),
+in_data.dptr());
+});
   }
+}
 
-  virtual void Backward(const OpContext ,
-const std::vector _grad,
-const std::vector _data,
-const std::vector _data,
-const std::vector ,
-const std::vector _grad,
-const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
-CHECK_EQ(out_grad.size(), 1U);
-CHECK(in_data.size() == 1 && in_grad.size() == 1);
-CHECK_EQ(req.size(), 1U);
-Stream *s = ctx.get_stream();
-const TBlob& m_out_grad = out_grad[activation::kOut];
-const TBlob& m_out_data = out_data[activation::kOut];
-const TBlob&  m_in_grad = in_grad[activation::kData];
-const size_t sz = m_out_data.shape_.Size();
-if (sz) {
-  MXNET_ASSIGN_REQ_SWITCH(req[activation::kData], Req, {
-mxnet_op::Kernel, 
xpu>::Launch(
-  s, sz,
-  m_in_grad.dptr(),
-  m_out_grad.dptr(),
-  m_out_data.dptr());
-  });
-}
+template
+void ActivationBackward(const OpContext , const TBlob _grad,
+const TBlob _data, const OpReqType ,
+const TBlob _grad) {
+  using namespace mshadow;
+  using namespace mshadow::expr;
+  Stream *s = ctx.get_stream();
+  const size_t sz = out_data.shape_.Size();
+  if (sz) {
+MXNET_ASSIGN_REQ_SWITCH(req, Req, {
+  mxnet_op::Kernel, 
xpu>::Launch(
+s, sz,
+in_grad.dptr(),
+out_grad.dptr(),
+out_data.dptr());
+});
   }
-};  // class ActivationOp
+}
 
-// Declare Factory function, used for dispatch specialization
 template
-Operator* CreateOp(ActivationParam type, int dtype, const TShape& dshape);
-
-#if DMLC_USE_CXX11
-class ActivationProp : public OperatorProperty {
- public:
-  void Init(const std::vector >& kwargs) 
override {
-param_.Init(kwargs);
-  }
-
-  std::map GetParams() const override {
-return param_.__DICT__();
-  }
-
-  bool InferShape(std::vector *in_shape,
-  std::vector *out_shape,
-  std::vector *aux_shape) const override {
-using namespace mshadow;
-CHECK_EQ(in_shape->size(), 1U) << "Input:[data]";
-const TShape  = in_shape->at(activation::kData);
-if (dshape.ndim() == 0) return false;
-out_shape->clear();
-out_shape->push_back(dshape);
-return true;
-  }
-
-  bool InferType(std::vector *in_type,
- std::vector *out_type,
- std::vector *aux_type) const override {
-CHECK_GE(in_type->size(), 1U);
-int dtype = (*in_type)[0];
-CHECK_NE(dtype, -1) << "First input must have specified type";
-for (index_t i = 0; i < in_type->size(); ++i) {
-  if ((*in_type)[i] == -1) {
-  (*in_type)[i] = dtype;
-  } else {
-UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]);
-  }
+void _ActivationCompute(const ActivationParam , const OpContext ,
+const TBlob , OpReqType req, 

[GitHub] piiswrong commented on issue #8070: modify shell file of classification for gluon

2017-12-12 Thread GitBox
piiswrong commented on issue #8070: modify shell file of classification for 
gluon
URL: https://github.com/apache/incubator-mxnet/pull/8070#issuecomment-351210443
 
 
   closing due to outdated.
   @zhreshold Please take over if you think this is still relevant.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8070: modify shell file of classification for gluon

2017-12-12 Thread GitBox
piiswrong closed pull request #8070: modify shell file of classification for 
gluon
URL: https://github.com/apache/incubator-mxnet/pull/8070
 
 
   

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

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

diff --git a/example/gluon/image_classification.py 
b/example/gluon/image_classification.py
index 8481afb50c..34915bd2b9 100644
--- a/example/gluon/image_classification.py
+++ b/example/gluon/image_classification.py
@@ -64,6 +64,18 @@
 parser.add_argument('--kvstore', type=str, default='device',
 help='kvstore to use for trainer/module.')
 parser.add_argument('--log-interval', type=int, default=50, help='Number of 
batches to wait before logging.')
+parser.add_argument('--lr-factor', type=float, default=0.1,
+help='the ratio to reduce lr on each step')
+parser.add_argument('--lr-step-epochs', type=str, default='30,60',
+   help='the epochs to reduce the lr, e.g. 30,60')
+parser.add_argument('--num-examples', type=int, default=1281167,
+help='the number of training examples')
+parser.add_argument('--load-epoch', type=int,
+help = 'load the model on an epoch using the 
model-load-prefix')
+parser.add_argument('--model-prefix', type=str, default='model/',
+help='model prefix')
+parser.add_argument('--optimizer', type=str, default='sgd',
+   help='the optimizer type')
 opt = parser.parse_args()
 
 logging.info(opt)
@@ -107,6 +119,45 @@
 else:
 train_data, val_data = dummy_iterator(batch_size, (3, 224, 224))
 
+kv = mx.kvstore.create(opt.kvstore)
+def _get_lr_scheduler():
+if 'lr_factor' not in opt or opt.lr_factor >= 1:
+return (opt.lr, None)
+epoch_size = int(opt.num_examples / opt.batch_size / opt.num_gpus)
+if 'dist' in opt.kvstore:
+epoch_size /= kv.num_workers
+begin_epoch = opt.load_epoch if opt.load_epoch else 0
+step_epochs = [int(l) for l in opt.lr_step_epochs.split(',')]
+lr = opt.lr
+for s in step_epochs:
+if begin_epoch >= s:
+lr *= opt.lr_factor
+if lr != opt.lr:
+logging.info('Adjust learning rate to %e for epoch %d' %(lr, 
begin_epoch))
+steps = [epoch_size * (x-begin_epoch) for x in step_epochs if 
x-begin_epoch > 0]
+return (lr, mx.lr_scheduler.MultiFactorScheduler(step=steps, 
factor=opt.lr_factor))
+
+def _load_model(rank=0):
+if 'load_epoch' not in opt or opt.load_epoch is None:
+return (None, None, None)
+assert opt.model_prefix is not None
+model_prefix = opt.model_prefix
+if rank > 0 and os.path.exists("%s-%d-symbol.json" % (model_prefix, rank)):
+model_prefix += "-%d" % (rank)
+sym, arg_params, aux_params = mx.model.load_checkpoint(
+model_prefix, opt.load_epoch)
+logging.info('Loaded model %s_%04d.params', model_prefix, opt.load_epoch)
+return (sym, arg_params, aux_params)
+
+def _save_model(rank=0):
+if opt.model_prefix is None:
+return None
+dst_dir = os.path.dirname(opt.model_prefix)
+if not os.path.isdir(dst_dir):
+os.mkdir(dst_dir)
+return mx.callback.do_checkpoint(opt.model_prefix if rank == 0 else 
"%s-%d" % (
+opt.model_prefix, rank))
+
 def test(ctx):
 metric = mx.metric.Accuracy()
 val_data.reset()
@@ -172,16 +223,47 @@ def train(epochs, ctx):
 out = net(data)
 softmax = mx.sym.SoftmaxOutput(out, name='softmax')
 mod = mx.mod.Module(softmax, context=[mx.gpu(i) for i in 
range(num_gpus)] if num_gpus > 0 else [mx.cpu()])
+
+# load model
+if 'arg_params' in kwargs and 'aux_params' in kwargs:
+arg_params = kwargs['arg_params']
+aux_params = kwargs['aux_params']
+else:
+sym, arg_params, aux_params = _load_model(kv.rank)
+if sym is not None:
+assert sym.tojson() == softmax.tojson()
+
+# save model
+checkpoint = _save_model(kv.rank)
+
+# learning rate
+lr, lr_scheduler = _get_lr_scheduler()
+optimizer_params = {
+'learning_rate': lr,
+'wd': opt.wd,
+'lr_scheduler': lr_scheduler}
+# Add 'multi_precision' parameter only for SGD optimizer
+if opt.optimizer == 'sgd':
+optimizer_params['multi_precision'] = True
+
+# Only a limited number of optimizers have 'momentum' property
+has_momentum = {'sgd', 'dcasgd', 'nag'}
+if opt.optimizer in has_momentum:
+optimizer_params['momentum'] = opt.momentum
+
 mod.fit(train_data,
+begin_epoch=opt.load_epoch if opt.load_epoch else 0,
 eval_data = val_data,
 num_epoch=opt.epochs,
-kvstore=opt.kvstore,

[GitHub] zheng-da commented on a change in pull request #8302: Refactor operators & MKLDNN

2017-12-12 Thread GitBox
zheng-da commented on a change in pull request #8302: Refactor operators & 
MKLDNN
URL: https://github.com/apache/incubator-mxnet/pull/8302#discussion_r156509390
 
 

 ##
 File path: src/operator/nn/activation-inl.h
 ##
 @@ -61,158 +62,127 @@ struct ActivationParam : public 
dmlc::Parameter {
   }
 };
 
-/**
- * \brief This is the implementation of activation operator.
- * \tparam xpu The device that the op will be executed on.
- */
 template
-class ActivationOp : public Operator {
- public:
-  virtual void Forward(const OpContext ,
-   const std::vector _data,
-   const std::vector ,
-   const std::vector _data,
-   const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
-CHECK_EQ(in_data.size(), 1U);
-CHECK_EQ(out_data.size(), 1U);
-Stream *s = ctx.get_stream();
-const TBlob& input = in_data[activation::kData];
-const size_t sz = input.shape_.Size();
-if (sz) {
-  MXNET_ASSIGN_REQ_SWITCH(req[activation::kOut], Req, {
-mxnet_op::Kernel, xpu>::Launch(
-  s, sz,
-  out_data[activation::kOut].dptr(),
-  input.dptr());
-  });
-}
+void ActivationForward(const OpContext , const TBlob _data,
+   const OpReqType , const TBlob _data) {
+  using namespace mshadow;
+  using namespace mshadow::expr;
+  Stream *s = ctx.get_stream();
+  const size_t sz = in_data.shape_.Size();
+  if (sz) {
+MXNET_ASSIGN_REQ_SWITCH(req, Req, {
+  mxnet_op::Kernel, xpu>::Launch(
+s, sz,
+out_data.dptr(),
+in_data.dptr());
+});
   }
+}
 
-  virtual void Backward(const OpContext ,
-const std::vector _grad,
-const std::vector _data,
-const std::vector _data,
-const std::vector ,
-const std::vector _grad,
-const std::vector _args) {
-using namespace mshadow;
-using namespace mshadow::expr;
-CHECK_EQ(out_grad.size(), 1U);
-CHECK(in_data.size() == 1 && in_grad.size() == 1);
-CHECK_EQ(req.size(), 1U);
-Stream *s = ctx.get_stream();
-const TBlob& m_out_grad = out_grad[activation::kOut];
-const TBlob& m_out_data = out_data[activation::kOut];
-const TBlob&  m_in_grad = in_grad[activation::kData];
-const size_t sz = m_out_data.shape_.Size();
-if (sz) {
-  MXNET_ASSIGN_REQ_SWITCH(req[activation::kData], Req, {
-mxnet_op::Kernel, 
xpu>::Launch(
-  s, sz,
-  m_in_grad.dptr(),
-  m_out_grad.dptr(),
-  m_out_data.dptr());
-  });
-}
+template
+void ActivationBackward(const OpContext , const TBlob _grad,
+const TBlob _data, const OpReqType ,
+const TBlob _grad) {
+  using namespace mshadow;
+  using namespace mshadow::expr;
+  Stream *s = ctx.get_stream();
+  const size_t sz = out_data.shape_.Size();
+  if (sz) {
+MXNET_ASSIGN_REQ_SWITCH(req, Req, {
+  mxnet_op::Kernel, 
xpu>::Launch(
+s, sz,
+in_grad.dptr(),
+out_grad.dptr(),
+out_data.dptr());
+});
   }
-};  // class ActivationOp
+}
 
-// Declare Factory function, used for dispatch specialization
 template
-Operator* CreateOp(ActivationParam type, int dtype, const TShape& dshape);
-
-#if DMLC_USE_CXX11
-class ActivationProp : public OperatorProperty {
- public:
-  void Init(const std::vector >& kwargs) 
override {
-param_.Init(kwargs);
-  }
-
-  std::map GetParams() const override {
-return param_.__DICT__();
-  }
-
-  bool InferShape(std::vector *in_shape,
-  std::vector *out_shape,
-  std::vector *aux_shape) const override {
-using namespace mshadow;
-CHECK_EQ(in_shape->size(), 1U) << "Input:[data]";
-const TShape  = in_shape->at(activation::kData);
-if (dshape.ndim() == 0) return false;
-out_shape->clear();
-out_shape->push_back(dshape);
-return true;
-  }
-
-  bool InferType(std::vector *in_type,
- std::vector *out_type,
- std::vector *aux_type) const override {
-CHECK_GE(in_type->size(), 1U);
-int dtype = (*in_type)[0];
-CHECK_NE(dtype, -1) << "First input must have specified type";
-for (index_t i = 0; i < in_type->size(); ++i) {
-  if ((*in_type)[i] == -1) {
-  (*in_type)[i] = dtype;
-  } else {
-UNIFORM_TYPE_CHECK((*in_type)[i], dtype, ListArguments()[i]);
-  }
+void _ActivationCompute(const ActivationParam , const OpContext ,
+const TBlob , OpReqType req, 

[GitHub] piiswrong commented on issue #7781: Implement Khatri-Rao operator

2017-12-12 Thread GitBox
piiswrong commented on issue #7781: Implement Khatri-Rao operator
URL: https://github.com/apache/incubator-mxnet/pull/7781#issuecomment-351210702
 
 
   @cswiercz Could you rebase to current master?


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


With regards,
Apache Git Services


  1   2   3   >