[GitHub] jiarenyf commented on issue #8315: There is a bug in metric.py

2017-10-19 Thread GitBox
jiarenyf commented on issue #8315: There is a bug in metric.py
URL: 
https://github.com/apache/incubator-mxnet/issues/8315#issuecomment-338111435
 
 
   By the way, I found that  nearly no one answer issue questions for a long 
time ... Is this framework being given up ...


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


With regards,
Apache Git Services


[GitHub] jiarenyf commented on issue #8315: There is a bug in metric.py

2017-10-19 Thread GitBox
jiarenyf commented on issue #8315: There is a bug in metric.py
URL: 
https://github.com/apache/incubator-mxnet/issues/8315#issuecomment-33844
 
 
   ... The `output_names` is None (default), or a list when you new a metric 
class with a arg called output_names ... It can not be a int ...


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


With regards,
Apache Git Services


[GitHub] liuzhi136 commented on issue #8341: Training error always fluctuates and doesn't decrease.

2017-10-19 Thread GitBox
liuzhi136 commented on issue #8341: Training error always fluctuates and 
doesn't decrease.
URL: 
https://github.com/apache/incubator-mxnet/issues/8341#issuecomment-338108545
 
 
   @szha Do you have any idea about this?


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


With regards,
Apache Git Services


[GitHub] jiarenyf commented on issue #8347: CTC Example Problem

2017-10-19 Thread GitBox
jiarenyf commented on issue #8347: CTC Example Problem
URL: 
https://github.com/apache/incubator-mxnet/issues/8347#issuecomment-338108475
 
 
   ??


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


With regards,
Apache Git Services


[GitHub] zheng-da commented on issue #8354: How to add NNVM operator with auxiliary states

2017-10-19 Thread GitBox
zheng-da commented on issue #8354: How to add NNVM operator with auxiliary 
states
URL: 
https://github.com/apache/incubator-mxnet/issues/8354#issuecomment-338100362
 
 
   You can use nnvm::FMutateInputs to specify auxiliary states. The link below 
shows an example.
   
https://github.com/zheng-da/incubator-mxnet/blob/refactor/src/operator/nn/batch_norm.cc#L448


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 issue #8338: master branch cannot build on centos 7 with cuda-8.0

2017-10-19 Thread GitBox
ZiyueHuang commented on issue #8338: master branch cannot build on centos 7 
with cuda-8.0
URL: 
https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-338100092
 
 
   @mseeger Yes, if I checkout to 9f97dac76e43b2ca0acb09a4ff96d416e9edea60, the 
one just before your commit. It can build successfully on my machine without 
these warnings. I also have no idea where uint8_t comes from.


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


With regards,
Apache Git Services


[GitHub] shadowleaves opened a new issue #4045: inferred shape error with FullyConnected layer

2017-10-19 Thread GitBox
shadowleaves opened a new issue #4045: inferred shape error with FullyConnected 
layer
URL: https://github.com/apache/incubator-mxnet/issues/4045
 
 
   very simple program that starts with two input nodes (batch_size=100, 
n_inputs=2) and then maps it to a layer of 3 hidden nodes via a 2x3 weight 
matrix. got the following error. any idea what's going on? how could the 
inferred shape be (3,2)? 
   
   ```
   mxnet.base.MXNetError: InferShape Error in fullyconnected0's weight argument
   Shape inconsistent, Provided=(2,3), inferred shape=(3,2)Corresponding 
keyword of symbol: wx
   Shape inconsistent, Provided=(2,3), inferred shape=(3,2)
   ```
   
   ```
   #!/usr/bin/env python
   
   import mxnet as mx
   import numpy as np
   
   
   if __name__ == '__main__':
   
   # Create dataset
   nb_train = 2000  # Number of training samples
   batch_size = 100
   
   X_train = np.random.sample((nb_train, 2))
   T_train = np.random.sample((nb_train, ))
   
   train_dataiter = mx.io.NDArrayIter(data=X_train,
  label=T_train,
  batch_size=batch_size,
  label_name='softmax_label',
  shuffle=True)
   
   net = mx.symbol.Variable('data')
   wx = mx.sym.Variable('wx', shape=(2, 3))
   net = mx.symbol.FullyConnected(data=net, num_hidden=3,
  weight=wx,
  no_bias=True)
   net = mx.symbol.SoftmaxOutput(data=net, name='softmax')
   
   mod = mx.mod.Module(net)
   mod.bind(data_shapes=train_dataiter.provide_data,
label_shapes=train_dataiter.provide_label)
   ```


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


With regards,
Apache Git Services


[GitHub] yuewu001 opened a new issue #8354: How to add NNVM operator with auxiliary states

2017-10-19 Thread GitBox
yuewu001 opened a new issue #8354: How to add NNVM operator with auxiliary 
states
URL: https://github.com/apache/incubator-mxnet/issues/8354
 
 
   When adding new operators with auxiliary states, how to set the attributes 
with NNVM_REGISTER_OP ?  


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


With regards,
Apache Git Services


[GitHub] chinakook commented on issue #8335: Performance of MXNet on Windows is lower than that on Linux by 15%-20%

2017-10-19 Thread GitBox
chinakook commented on issue #8335: Performance of MXNet on Windows  is lower 
than that on Linux by 15%-20%
URL: 
https://github.com/apache/incubator-mxnet/issues/8335#issuecomment-338080017
 
 
   But the cpu performance of Windows is also lower. Our customers use Windows 
so I cannot give up.


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


With regards,
Apache Git Services


[GitHub] rahul003 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
rahul003 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145859932
 
 

 ##
 File path: src/kvstore/comm.h
 ##
 @@ -79,8 +79,35 @@ class Comm {
 return pinned_ctx_;
   }
 
+  /**
+   * \brief Sets gradient compression parameters to be able to
+   * perform reduce with compressed gradients
+   */
+  inline void SetCompress(const std::string& compress,
 
 Review comment:
   Not sure I follow.
   Are you referring to the formatting of lines 87 and 88? 
   Or do you think perform should be indented to the right?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#discussion_r145845639
 
 

 ##
 File path: src/operator/tensor/init_op.h
 ##
 @@ -164,19 +164,38 @@ inline bool InitStorageType(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+/*! \brief Fill output with a scalar integer value */
 template
 void FillCompute(const nnvm::NodeAttrs& attrs,
  const OpContext& ctx,
  const std::vector& inputs,
  const std::vector& req,
  const std::vector& outputs) {
-  using namespace mshadow;
-  using namespace mshadow::expr;
-  Stream *s = ctx.get_stream();
-  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-Tensor out = outputs[0].FlatTo1D(s);
-ASSIGN_DISPATCH(out, req[0], scalar(value));
-  });
+  if (req[0] != kNullOp) {
+mshadow::Stream *s = ctx.get_stream();
+MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+  mxnet_op::Kernel::Launch(s,
+ outputs[0].Size(),
+ 
outputs[0].dptr());
+});
+  }
+}
+
+/*! \brief Fast CPU fill-zero version using memset */
+template<>
+inline void FillCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  if (req[0] != kNullOp) {
+const size_t size = outputs[0].Size();
+if (size) {
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+memset(outputs[0].dptr(), 0, size * sizeof(DType));
 
 Review comment:
   a lot faster. assembly for memset looks something like:
   ; for 32 bit, load each eax register register byte with destination value
   mov eax, 
   shl eax, 8
   or al, ah
   shl eax, 8
   or al, ah
   shl eax, 8
   mov edi, [pointer]
   mov ecx, [size]
   shr ecx, 2
   rep stosd  ; clock cycle count, size/4 *  
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   mov ecx, [size]
   and ecx, 3 
   rep stosb ; clock cycle count, (size & 3 ) * 
ttps://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   
   
   This is done without any change in code execution path (jmp, jle, jge, jz, 
etc) or compares
   It is also very cache-friendly since it is perfectly sequential.
   


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#discussion_r145845639
 
 

 ##
 File path: src/operator/tensor/init_op.h
 ##
 @@ -164,19 +164,38 @@ inline bool InitStorageType(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+/*! \brief Fill output with a scalar integer value */
 template
 void FillCompute(const nnvm::NodeAttrs& attrs,
  const OpContext& ctx,
  const std::vector& inputs,
  const std::vector& req,
  const std::vector& outputs) {
-  using namespace mshadow;
-  using namespace mshadow::expr;
-  Stream *s = ctx.get_stream();
-  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-Tensor out = outputs[0].FlatTo1D(s);
-ASSIGN_DISPATCH(out, req[0], scalar(value));
-  });
+  if (req[0] != kNullOp) {
+mshadow::Stream *s = ctx.get_stream();
+MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+  mxnet_op::Kernel::Launch(s,
+ outputs[0].Size(),
+ 
outputs[0].dptr());
+});
+  }
+}
+
+/*! \brief Fast CPU fill-zero version using memset */
+template<>
+inline void FillCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  if (req[0] != kNullOp) {
+const size_t size = outputs[0].Size();
+if (size) {
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+memset(outputs[0].dptr(), 0, size * sizeof(DType));
 
 Review comment:
   a lot faster. assembly for memset looks something like:
   ; for 32 bit, load each eax register register byte with destination value
   mov eax, 
   shl eax, 8
   or al, ah
   shl eax, 8
   or al, ah
   shl eax, 8
   mov edi, [pointer]
   mov ecx, [size]
   shr ecx, 2
   rep stosd  ; clock cycle count, size/4 *  
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   mov ecx, [size]
   and ecx, 3 ; clock cycle count, (size & 3 ) *  
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   rep stosb
   
   This is done without any change in code execution path (jmp, jle, jge, jz, 
etc) or compares
   It is also very cache-friendly since it is perfectly sequential.
   


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338058033
 
 
   I had to set `sparse_label=False` in my loss function, which now looks like:
   
   `gluon.loss.SoftmaxCrossEntropyLoss(sparse_label=False)`


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#discussion_r145845639
 
 

 ##
 File path: src/operator/tensor/init_op.h
 ##
 @@ -164,19 +164,38 @@ inline bool InitStorageType(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+/*! \brief Fill output with a scalar integer value */
 template
 void FillCompute(const nnvm::NodeAttrs& attrs,
  const OpContext& ctx,
  const std::vector& inputs,
  const std::vector& req,
  const std::vector& outputs) {
-  using namespace mshadow;
-  using namespace mshadow::expr;
-  Stream *s = ctx.get_stream();
-  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-Tensor out = outputs[0].FlatTo1D(s);
-ASSIGN_DISPATCH(out, req[0], scalar(value));
-  });
+  if (req[0] != kNullOp) {
+mshadow::Stream *s = ctx.get_stream();
+MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+  mxnet_op::Kernel::Launch(s,
+ outputs[0].Size(),
+ 
outputs[0].dptr());
+});
+  }
+}
+
+/*! \brief Fast CPU fill-zero version using memset */
+template<>
+inline void FillCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  if (req[0] != kNullOp) {
+const size_t size = outputs[0].Size();
+if (size) {
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+memset(outputs[0].dptr(), 0, size * sizeof(DType));
 
 Review comment:
   a lot faster. assembly for memset looks something like:
   ; for 32 bit, load each eax register register byte with destination value
   mov eax, 
   shl eax, 8
   or al, ah
   shl eax, 8
   or al, ah
   shl eax, 8
   mov edi, 
   mov ecx, 
   shr ecx, 2
   rep stosd  ; clock cycle count, size/4 *  
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   mov ecx, 
   and ecx, 3 ; clock cycle count, (size & 3 ) *  
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   rep stosb
   
   This is done without any change in code execution path (jmp, jle, jge, jz, 
etc) or compares
   It is also very cache-friendly since it is perfectly sequential.
   


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#discussion_r145845639
 
 

 ##
 File path: src/operator/tensor/init_op.h
 ##
 @@ -164,19 +164,38 @@ inline bool InitStorageType(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+/*! \brief Fill output with a scalar integer value */
 template
 void FillCompute(const nnvm::NodeAttrs& attrs,
  const OpContext& ctx,
  const std::vector& inputs,
  const std::vector& req,
  const std::vector& outputs) {
-  using namespace mshadow;
-  using namespace mshadow::expr;
-  Stream *s = ctx.get_stream();
-  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-Tensor out = outputs[0].FlatTo1D(s);
-ASSIGN_DISPATCH(out, req[0], scalar(value));
-  });
+  if (req[0] != kNullOp) {
+mshadow::Stream *s = ctx.get_stream();
+MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+  mxnet_op::Kernel::Launch(s,
+ outputs[0].Size(),
+ 
outputs[0].dptr());
+});
+  }
+}
+
+/*! \brief Fast CPU fill-zero version using memset */
+template<>
+inline void FillCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  if (req[0] != kNullOp) {
+const size_t size = outputs[0].Size();
+if (size) {
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+memset(outputs[0].dptr(), 0, size * sizeof(DType));
 
 Review comment:
   a lot faster. assembly for memset looks something like:
   ; for 32 bit, load each eax register register byte with destination value
   mov eax, 
   shl eax, 8
   or al, ah
   shl eax, 8
   or al, ah
   shl eax, 8
   mov edi, 
   mov ecx, 
   shr ecx, 2
   rep stosd  ; clock cycle coun, size * t: 
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   mov ecx, 
   and ecx, 3
   rep stosb
   
   This is done without any change in code execution path (jmp, jle, jge, jz, 
etc) or compares
   It is also very cache-friendly since it is perfectly sequential.
   


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#discussion_r145845639
 
 

 ##
 File path: src/operator/tensor/init_op.h
 ##
 @@ -164,19 +164,38 @@ inline bool InitStorageType(const nnvm::NodeAttrs& attrs,
   return true;
 }
 
+/*! \brief Fill output with a scalar integer value */
 template
 void FillCompute(const nnvm::NodeAttrs& attrs,
  const OpContext& ctx,
  const std::vector& inputs,
  const std::vector& req,
  const std::vector& outputs) {
-  using namespace mshadow;
-  using namespace mshadow::expr;
-  Stream *s = ctx.get_stream();
-  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
-Tensor out = outputs[0].FlatTo1D(s);
-ASSIGN_DISPATCH(out, req[0], scalar(value));
-  });
+  if (req[0] != kNullOp) {
+mshadow::Stream *s = ctx.get_stream();
+MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+  mxnet_op::Kernel::Launch(s,
+ outputs[0].Size(),
+ 
outputs[0].dptr());
+});
+  }
+}
+
+/*! \brief Fast CPU fill-zero version using memset */
+template<>
+inline void FillCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  if (req[0] != kNullOp) {
+const size_t size = outputs[0].Size();
+if (size) {
+  MSHADOW_TYPE_SWITCH(outputs[0].type_flag_, DType, {
+memset(outputs[0].dptr(), 0, size * sizeof(DType));
 
 Review comment:
   a lot faster. assembly for memset looks something like:
   ; for 32 bit, load each register byte with destination value
   mov eax, 
   shl eax, 8
   or al, ah
   shl eax, 8
   or al, ah
   shl eax, 8
   mov edi, 
   mov ecx, 
   shr ecx, 2
   rep stosd  ; clock cycle coun, size * t: 
https://web.itu.edu.tr/kesgin/mul06/intel/instr/stos.html
   mov ecx, 
   and ecx, 3
   rep stosb
   
   This is done without any change in code execution path (jmp, jle, jge, jz, 
etc) or compares
   It is also very cache-friendly since it is perfectly sequential.
   


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


With regards,
Apache Git Services


[GitHub] louisfeng commented on a change in pull request #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
louisfeng commented on a change in pull request #7931: MKL-DNN integration: 
request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r145845602
 
 

 ##
 File path: src/operator/mkl/mkldnn_elemwise_sum-inl.h
 ##
 @@ -0,0 +1,233 @@
+/***
+* Copyright 2016-2017 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* \file mkldnn_elemwise_sum-inl.h
+* \brief
+* \author young.jin@intel.com
+* ashok.em...@intel.com
+* deepthi.kark...@intel.com
+* louis.f...@intel.com
+* adam.d.st...@intel.com
+*
+*
+***/
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+#include "../operator_common.h"
+#include "../tensor/elemwise_binary_op.h"
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+#include "mkl_util-inl.h"
+
+namespace mxnet {
+namespace op {
+
+/**
+ * Adds n input data element-wise and store output to a single output buffer.
+ * @tparam xpu
+ * @tparam DType
+ * @param attrs
+ * @param ctx
+ * @param in_data
+ * @param req
+ * @param out_data
+ */
+template
 
 Review comment:
   This is a good point. I was following the convention of other MKLDNN 
operators to be consistent. I can change this to cpu only.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338061064
 
 
   Awesome, thank you so much


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
zhreshold commented on issue #8350: Incorrect implied shape inside loss function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338060914
 
 
   gluon.loss.SoftmaxCrossEntropyLoss(sparse_label=False)


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338060702
 
 
   Ok.  So what is the explicit correct loss function for one-hot labels?


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


With regards,
Apache Git Services


[GitHub] louisfeng commented on a change in pull request #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
louisfeng commented on a change in pull request #7931: MKL-DNN integration: 
request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r145844506
 
 

 ##
 File path: src/operator/mkl/mkldnn_elemwise_sum-inl.h
 ##
 @@ -0,0 +1,233 @@
+/***
+* Copyright 2016-2017 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* \file mkldnn_elemwise_sum-inl.h
+* \brief
+* \author young.jin@intel.com
+* ashok.em...@intel.com
+* deepthi.kark...@intel.com
+* louis.f...@intel.com
+* adam.d.st...@intel.com
+*
+*
+***/
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+#include "../operator_common.h"
+#include "../tensor/elemwise_binary_op.h"
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+#include "mkl_util-inl.h"
+
+namespace mxnet {
+namespace op {
+
+/**
+ * Adds n input data element-wise and store output to a single output buffer.
+ * @tparam xpu
+ * @tparam DType
+ * @param attrs
+ * @param ctx
+ * @param in_data
+ * @param req
+ * @param out_data
+ */
+template
+void MKLDNNElementWiseSumCompute(const nnvm::NodeAttrs ,
+ const OpContext ,
+ const std::vector _data,
+ const std::vector ,
+ const std::vector _data) {
+  using namespace mxnet_op;
+  using namespace mshadow;
+  using namespace mshadow::expr;
+
+  if (req[0] == kNullOp) return;
+
+  Stream *s = ctx.get_stream();
 
 Review comment:
   This is true right now. We may need to use the stream when we try to support 
other tensor shapes beside nchw. I can remove it for now.


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
zhreshold commented on issue #8350: Incorrect implied shape inside loss function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338060442
 
 
   @nickeleres  Just to mention that what I meant is sparse_label=False, 
from_logits is used if log_softmax is applied prior to the loss function.


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


With regards,
Apache Git Services


[GitHub] szha commented on issue #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
szha commented on issue #7931: MKL-DNN integration: request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#issuecomment-338059265
 
 
   @ykim362 BTW is the fix in mklml_lnx_2018.0.20170908.tgz? Does it make sense 
to upgrade the library for mkl2017 use case? Many people are using MKL version 
(with MKL2017 and experimental on).


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8348: mxnet.gluon.data.vision.ImageRecordDataset key error

2017-10-19 Thread GitBox
zhreshold commented on issue #8348: mxnet.gluon.data.vision.ImageRecordDataset 
key error
URL: 
https://github.com/apache/incubator-mxnet/issues/8348#issuecomment-338058462
 
 
   Should be fixed in #8353


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


With regards,
Apache Git Services


[GitHub] ykim362 commented on issue #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
ykim362 commented on issue #7931: MKL-DNN integration: request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#issuecomment-338058204
 
 
   @szha Sure, I am looking into 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] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338058033
 
 
   I had to set `sparse_label=False` in my loss function, which now looks like:
   
   `gluon.loss.SoftmaxCrossEntropyLoss(sparse_label=False, from_logits=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] nickeleres closed issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres closed issue #8350: Incorrect implied shape inside loss function
URL: https://github.com/apache/incubator-mxnet/issues/8350
 
 
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
szha commented on issue #7931: MKL-DNN integration: request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#issuecomment-338057682
 
 
   @ykim362 could you verify if #8196 is fixed?


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


With regards,
Apache Git Services


[GitHub] zheng-da commented on a change in pull request #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
zheng-da commented on a change in pull request #7931: MKL-DNN integration: 
request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r145817839
 
 

 ##
 File path: src/operator/mkl/mkldnn_elemwise_sum-inl.h
 ##
 @@ -0,0 +1,233 @@
+/***
+* Copyright 2016-2017 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* \file mkldnn_elemwise_sum-inl.h
+* \brief
+* \author young.jin@intel.com
+* ashok.em...@intel.com
+* deepthi.kark...@intel.com
+* louis.f...@intel.com
+* adam.d.st...@intel.com
+*
+*
+***/
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+#include "../operator_common.h"
+#include "../tensor/elemwise_binary_op.h"
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+#include "mkl_util-inl.h"
+
+namespace mxnet {
+namespace op {
+
+/**
+ * Adds n input data element-wise and store output to a single output buffer.
+ * @tparam xpu
+ * @tparam DType
+ * @param attrs
+ * @param ctx
+ * @param in_data
+ * @param req
+ * @param out_data
+ */
+template
 
 Review comment:
   Why do you need xpu for any MKLDNN functions? Doesn't the code always run on 
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] zheng-da commented on a change in pull request #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
zheng-da commented on a change in pull request #7931: MKL-DNN integration: 
request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r145819255
 
 

 ##
 File path: src/operator/tensor/elemwise_binary_op_basic.cc
 ##
 @@ -23,11 +23,22 @@
  */
 #include "./elemwise_unary_op.h"
 #include "./elemwise_binary_op-inl.h"
+#if MXNET_USE_MKLDNN == 1
+#include "../mkl/mkldnn_elemwise_sum-inl.h"
+#endif
 
 namespace mxnet {
 namespace op {
 
+#if MXNET_USE_MKLDNN == 1
+MXNET_OPERATOR_REGISTER_BINARY(elemwise_add)
+.set_attr("FInferStorageType", 
+  ElemwiseStorageType<2, 1, true, false, false>)   
\
+.set_attr("FCompute", MKLDNNElementWiseAddCompute) 
\
+.set_attr("FComputeEx", ElemwiseBinaryOp::ComputeEx)
 
 Review comment:
   MKLDNN implementation is only defined for FCompute?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #7931: MKL-DNN integration: request for reviews

2017-10-19 Thread GitBox
zheng-da commented on a change in pull request #7931: MKL-DNN integration: 
request for reviews
URL: https://github.com/apache/incubator-mxnet/pull/7931#discussion_r145817991
 
 

 ##
 File path: src/operator/mkl/mkldnn_elemwise_sum-inl.h
 ##
 @@ -0,0 +1,233 @@
+/***
+* Copyright 2016-2017 Intel Corporation
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* \file mkldnn_elemwise_sum-inl.h
+* \brief
+* \author young.jin@intel.com
+* ashok.em...@intel.com
+* deepthi.kark...@intel.com
+* louis.f...@intel.com
+* adam.d.st...@intel.com
+*
+*
+***/
+
+#pragma once
+
+#include 
+#include 
+#include 
+#include 
+#include "../operator_common.h"
+#include "../tensor/elemwise_binary_op.h"
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+#include "mkl_util-inl.h"
+
+namespace mxnet {
+namespace op {
+
+/**
+ * Adds n input data element-wise and store output to a single output buffer.
+ * @tparam xpu
+ * @tparam DType
+ * @param attrs
+ * @param ctx
+ * @param in_data
+ * @param req
+ * @param out_data
+ */
+template
+void MKLDNNElementWiseSumCompute(const nnvm::NodeAttrs ,
+ const OpContext ,
+ const std::vector _data,
+ const std::vector ,
+ const std::vector _data) {
+  using namespace mxnet_op;
+  using namespace mshadow;
+  using namespace mshadow::expr;
+
+  if (req[0] == kNullOp) return;
+
+  Stream *s = ctx.get_stream();
 
 Review comment:
   It doesn't seem the stream is used anywhere.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338056483
 
 
   This is my new loss function:
   
   `softmax_cross_entropy = 
gluon.loss.SoftmaxCrossEntropyLoss(from_logits=True)`
   
   And Im still getting:
   
   `MXNetError: Shape inconsistent, Provided=(32,51), inferred shape=(32,1)`
   
   Note: batch size is 32, and one-hot length is 51


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338056483
 
 
   This is my new loss function:
   
   `softmax_cross_entropy = 
gluon.loss.SoftmaxCrossEntropyLoss(from_logits=True)`
   
   And Im still getting:
   
   `MXNetError: Shape inconsistent, Provided=(32,51), inferred shape=(32,1)`
   
   Note: batch size is 32 and one-hot length is 51


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338056483
 
 
   This is my new loss function:
   
   `softmax_cross_entropy = 
gluon.loss.SoftmaxCrossEntropyLoss(from_logits=True)`
   
   And Im still getting:
   
   `MXNetError: Shape inconsistent, Provided=(32,51), inferred shape=(32,1)`


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
zhreshold commented on issue #8350: Incorrect implied shape inside loss function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338055150
 
 
   You can use gluon.loss.SoftmaxCrossEntropyLoss, where you can specify 
`from_logits=True` to use one_hot labels.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338052781
 
 
   No custom loss function
   
   `loss = softmax_cross_entropy(output, label)`
   
   It looks like the `SoftmaxCrossEntropyLoss` demo works the same way...
   
   ```
   data.shape (32L, 784L)
   label.shape (32L,)
   output.shape (32L, 10L)
   ```
   
   My labels are one-hot 1 arrays...so it appears that the 0 entry of each 
label tensor (_that's what shape (32,) is, right?_) in the batch is used as the 
label for every training example in the batch, which doesnt make sense to me.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338054520
 
 
   When I decrease the batch size to 1, the training labels are simply integers 
**(which is actually the 0th entry in the one-hot array for each actual 
label)**, confirming my above assumption


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338054520
 
 
   When I decrease the batch size to 1, the training labels are simply integers 
**(the 0th entry in the one-hot array for each actual label)**, confirming my 
above assumption


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on issue #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on issue #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#issuecomment-338053030
 
 
   Ok @szha and I spoke offline. I added the new operator _full to be used for 
ndarray.full() function.
   It is tested in test_ndarray.test_outputs()


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338052781
 
 
   No custom loss function
   
   `loss = softmax_cross_entropy(output, label)`
   
   It looks like the `SoftmaxCrossEntropyLoss` demo works the same way...
   
   ```
   data.shape (32L, 784L)
   label.shape (32L,)
   output.shape (32L, 10L)
   ```
   
   My labels are one-hot 1 tensors...so it appears that the 0 entry of each 
label tensor (_that's what shape (32,) is, right?_) in the batch is used as the 
label for every training example in the batch, which doesnt make sense to me.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338052781
 
 
   No custom loss function
   
   `loss = softmax_cross_entropy(output, label)`
   
   It looks like the `SoftmaxCrossEntropyLoss` demo works the same way...
   
   ```
   data.shape (32L, 784L)
   label.shape (32L,)
   output.shape (32L, 10L)
   ```
   
   My labels are one-hot 1 tensors...so it appears that the 0 entry for each 
label tensor in the batch is used as the label for every training example in 
the batch, which doesnt make sense to me.


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
zhreshold commented on issue #8350: Incorrect implied shape inside loss function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338051045
 
 
   Please post your custom loss function


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


With regards,
Apache Git Services


[GitHub] zhreshold closed issue #8310: Bug in ./example/

2017-10-19 Thread GitBox
zhreshold closed issue #8310: Bug in ./example/
URL: https://github.com/apache/incubator-mxnet/issues/8310
 
 
   


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338049715
 
 
   When I reshaped my label to (32, 1), as the error message stated, I got the 
training to run, but the alignment between the output batch and the associated 
label makes no sense...There is now a single label for an entire batch.


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


With regards,
Apache Git Services


[GitHub] zhreshold opened a new pull request #8352: fix using default mean pixels

2017-10-19 Thread GitBox
zhreshold opened a new pull request #8352: fix using default mean pixels
URL: https://github.com/apache/incubator-mxnet/pull/8352
 
 
   ## Description ##
   (Brief description on what this PR is about)
   
   ## Checklist ##
   ### Essentials ###
   - [x] Passed code style checking (`make lint`)
   - [x] Changes are complete (i.e. I finished coding on this PR)
   - [x] To my best knowledge, examples are either not affected by this change, 
or have been fixed to be compatible with this change
   
   #8310 


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832223
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+  std::vector inputs(3);
+  inputs[0] = from.data();
+  inputs[1] = res.data();
+  inputs[2] = ret.data();
+  mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+neg_threshold, 
pos_threshold);
+}, from.ctx(), {from.var()}, {ret.var(), res.var()},
+FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
 
 Review comment:
   Can this be combined with the above else into else if?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145833515
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
+DMLC_DECLARE_FIELD(pos_threshold)
+  .set_default(0.1)
+  .describe("Threshold to quantize positive values. "
+  "Has to be greater than 0");
+  }
+};
+
+template
+void Create2BitArrayCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // For now, this method can only compress the float data
+  mshadow::Stream *s = ctx.get_stream();
+  // Init the memory of output to 0x
+  mxnet_op::Kernel::Launch(s, outputs[0].Size(),
+  outputs[0].dptr());  // compressed array
+}
+
+inline bool Create2BitArrayShape(const nnvm::NodeAttrs& attrs,
+ std::vector *in_attrs,
+ std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK(!shape_is_none(in_attrs->at(0)));
+  // output
+  int shape = in_attrs->at(0).Size() % 16 == 0 ?
+in_attrs->at(0).Size() / 16 + 3:
+in_attrs->at(0).Size() / 16 + 4;
+  SHAPE_ASSIGN_CHECK(*out_attrs, 0, TShape{shape});
+  return true;
+}
+
+inline bool Create2BitArrayType(const nnvm::NodeAttrs ,
+std::vector *in_attrs,
+std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK_EQ((*in_attrs)[0], mshadow::kFloat32)
+<< "`create_2bit_` only supports float32 input for now";
+  TYPE_ASSIGN_CHECK(*out_attrs, 0, mshadow::kFloat32);
+  return true;
+}
+
+struct init_threshold_2bit {
+  MSHADOW_XINLINE static void Map(int i,
+  float *out,
+  const float neg_threshold,
+  const float pos_threshold,
+  int size) {
+// The first two elements in output are thresholds
+// The third element is the original size of the array
+out[0] = neg_threshold;
+out[1] = pos_threshold;
+// TODO(huilgolr) check potential problem here?
+out[2] = static_cast(size);
+  }
+};
+
+struct quantize_2bit {
+  MSHADOW_XINLINE static void Map(int block_id,
+  int grad_size,
+  float *out,
+  float *grad,
+  float *residual,
+  const float neg_threshold,
+  const float pos_threshold) {
+float* compr_block = out + block_id;
+// init to 0
+*compr_block = 0;
+// start and end are indices in original grad array
+int start = block_id*16;
+int end = (start+16 <= grad_size) ? start+16 : grad_size;
 
 Review comment:
   nit: const


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145833486
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
+DMLC_DECLARE_FIELD(pos_threshold)
+  .set_default(0.1)
+  .describe("Threshold to quantize positive values. "
+  "Has to be greater than 0");
+  }
+};
+
+template
+void Create2BitArrayCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // For now, this method can only compress the float data
+  mshadow::Stream *s = ctx.get_stream();
+  // Init the memory of output to 0x
+  mxnet_op::Kernel::Launch(s, outputs[0].Size(),
+  outputs[0].dptr());  // compressed array
+}
+
+inline bool Create2BitArrayShape(const nnvm::NodeAttrs& attrs,
+ std::vector *in_attrs,
+ std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK(!shape_is_none(in_attrs->at(0)));
+  // output
+  int shape = in_attrs->at(0).Size() % 16 == 0 ?
+in_attrs->at(0).Size() / 16 + 3:
+in_attrs->at(0).Size() / 16 + 4;
+  SHAPE_ASSIGN_CHECK(*out_attrs, 0, TShape{shape});
+  return true;
+}
+
+inline bool Create2BitArrayType(const nnvm::NodeAttrs ,
+std::vector *in_attrs,
+std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK_EQ((*in_attrs)[0], mshadow::kFloat32)
+<< "`create_2bit_` only supports float32 input for now";
+  TYPE_ASSIGN_CHECK(*out_attrs, 0, mshadow::kFloat32);
+  return true;
+}
+
+struct init_threshold_2bit {
+  MSHADOW_XINLINE static void Map(int i,
+  float *out,
+  const float neg_threshold,
+  const float pos_threshold,
+  int size) {
+// The first two elements in output are thresholds
+// The third element is the original size of the array
+out[0] = neg_threshold;
+out[1] = pos_threshold;
+// TODO(huilgolr) check potential problem here?
+out[2] = static_cast(size);
+  }
+};
+
+struct quantize_2bit {
+  MSHADOW_XINLINE static void Map(int block_id,
+  int grad_size,
+  float *out,
+  float *grad,
+  float *residual,
+  const float neg_threshold,
+  const float pos_threshold) {
+float* compr_block = out + block_id;
+// init to 0
+*compr_block = 0;
+// start and end are indices in original grad array
+int start = block_id*16;
 
 Review comment:
   nit: const



[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145831418
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
 
 Review comment:
   Why make a copy?  Will a refernce work?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832475
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+  std::vector inputs(3);
+  inputs[0] = from.data();
+  inputs[1] = res.data();
+  inputs[2] = ret.data();
+  mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+neg_threshold, 
pos_threshold);
+}, from.ctx(), {from.var()}, {ret.var(), res.var()},
+FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
+  if (compress == "2bit") {
+Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+std::vector inputs(3);
+inputs[0] = from.data();
+inputs[1] = res.data();
+inputs[2] = ret.data();
+mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+  neg_threshold, 
pos_threshold);
+// Wait GPU kernel to complete
+ctx.get_stream()->Wait();
+  }, from.ctx(), {from.var()}, {ret.var(), res.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeGPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+} else {
+  LOG(FATAL) << "unknown device mask";
+}
+#else
+LOG(FATAL) << MXNET_GPU_NOT_ENABLED_ERROR;
+#endif
+  }
+}
+
+void Dequantize(const NDArray , NDArray *to, const std::string& compress, 
int priority) {
+  CHECK(from.shape().ndim() != 0)
+<< "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, ret](RunContext ctx) {
+std::vector inputs(2);
+inputs[0] = from.data();
+inputs[1] = ret.data();
+mxnet::ndarray::Dequantize2BitDispatch(ctx.get_stream(), 
inputs);
+  }, from.ctx(), {from.var()}, {ret.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("DequantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported dequantization " << compress << std::endl;
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
+  if (compress == "2bit") {
+Engine::Get()->PushSync([from, ret](RunContext ctx) {
+  std::vector inputs(2);
 
 Review comment:
   Same as above, superfluous calls of TBlob() constructor


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145833204
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
+DMLC_DECLARE_FIELD(pos_threshold)
+  .set_default(0.1)
+  .describe("Threshold to quantize positive values. "
+  "Has to be greater than 0");
+  }
+};
+
+template
+void Create2BitArrayCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // For now, this method can only compress the float data
+  mshadow::Stream *s = ctx.get_stream();
+  // Init the memory of output to 0x
+  mxnet_op::Kernel::Launch(s, outputs[0].Size(),
+  outputs[0].dptr());  // compressed array
+}
+
+inline bool Create2BitArrayShape(const nnvm::NodeAttrs& attrs,
+ std::vector *in_attrs,
+ std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK(!shape_is_none(in_attrs->at(0)));
+  // output
+  int shape = in_attrs->at(0).Size() % 16 == 0 ?
+in_attrs->at(0).Size() / 16 + 3:
+in_attrs->at(0).Size() / 16 + 4;
+  SHAPE_ASSIGN_CHECK(*out_attrs, 0, TShape{shape});
+  return true;
+}
+
+inline bool Create2BitArrayType(const nnvm::NodeAttrs ,
+std::vector *in_attrs,
+std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK_EQ((*in_attrs)[0], mshadow::kFloat32)
+<< "`create_2bit_` only supports float32 input for now";
+  TYPE_ASSIGN_CHECK(*out_attrs, 0, mshadow::kFloat32);
+  return true;
+}
+
+struct init_threshold_2bit {
+  MSHADOW_XINLINE static void Map(int i,
+  float *out,
+  const float neg_threshold,
+  const float pos_threshold,
+  int size) {
+// The first two elements in output are thresholds
 
 Review comment:
   This seem strange -- i is not used at all?  Can you explain?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145833629
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
+DMLC_DECLARE_FIELD(pos_threshold)
+  .set_default(0.1)
+  .describe("Threshold to quantize positive values. "
+  "Has to be greater than 0");
+  }
+};
+
+template
+void Create2BitArrayCompute(const nnvm::NodeAttrs& attrs,
+const OpContext& ctx,
+const std::vector& inputs,
+const std::vector& req,
+const std::vector& outputs) {
+  // For now, this method can only compress the float data
+  mshadow::Stream *s = ctx.get_stream();
+  // Init the memory of output to 0x
+  mxnet_op::Kernel::Launch(s, outputs[0].Size(),
+  outputs[0].dptr());  // compressed array
+}
+
+inline bool Create2BitArrayShape(const nnvm::NodeAttrs& attrs,
+ std::vector *in_attrs,
+ std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK(!shape_is_none(in_attrs->at(0)));
+  // output
+  int shape = in_attrs->at(0).Size() % 16 == 0 ?
+in_attrs->at(0).Size() / 16 + 3:
+in_attrs->at(0).Size() / 16 + 4;
+  SHAPE_ASSIGN_CHECK(*out_attrs, 0, TShape{shape});
+  return true;
+}
+
+inline bool Create2BitArrayType(const nnvm::NodeAttrs ,
+std::vector *in_attrs,
+std::vector *out_attrs) {
+  // 0. input array
+  CHECK_EQ(in_attrs->size(), 1U);
+  // 0. output array
+  CHECK_EQ(out_attrs->size(), 1U);
+  // check input
+  CHECK_EQ((*in_attrs)[0], mshadow::kFloat32)
+<< "`create_2bit_` only supports float32 input for now";
+  TYPE_ASSIGN_CHECK(*out_attrs, 0, mshadow::kFloat32);
+  return true;
+}
+
+struct init_threshold_2bit {
+  MSHADOW_XINLINE static void Map(int i,
+  float *out,
+  const float neg_threshold,
+  const float pos_threshold,
+  int size) {
+// The first two elements in output are thresholds
+// The third element is the original size of the array
+out[0] = neg_threshold;
+out[1] = pos_threshold;
+// TODO(huilgolr) check potential problem here?
+out[2] = static_cast(size);
+  }
+};
+
+struct quantize_2bit {
+  MSHADOW_XINLINE static void Map(int block_id,
+  int grad_size,
+  float *out,
+  float *grad,
+  float *residual,
+  const float neg_threshold,
+  const float pos_threshold) {
+float* compr_block = out + block_id;
+// init to 0
+*compr_block = 0;
+// start and end are indices in original grad array
+int start = block_id*16;
+int end = (start+16 <= grad_size) ? start+16 : grad_size;
+char* block_ptr = reinterpret_cast 

[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832626
 
 

 ##
 File path: src/ndarray/ndarray_function.cc
 ##
 @@ -183,5 +184,22 @@ void ElementwiseSum(mshadow::Stream* s,
   }
 }
 
+/*
+ * \brief Enables use of function defined under Dequantize2Bit operator for an 
ndarray
 
 Review comment:
   ?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145831125
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
 
 Review comment:
   not: const for a and b


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145831333
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
 
 Review comment:
   res and ret passing by value is expensive. Please pass as reference or pass 
the pointers


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832799
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
 
 Review comment:
   nit: "Must be"


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832433
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+  std::vector inputs(3);
+  inputs[0] = from.data();
+  inputs[1] = res.data();
+  inputs[2] = ret.data();
+  mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+neg_threshold, 
pos_threshold);
+}, from.ctx(), {from.var()}, {ret.var(), res.var()},
+FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
+  if (compress == "2bit") {
+Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+std::vector inputs(3);
+inputs[0] = from.data();
+inputs[1] = res.data();
+inputs[2] = ret.data();
+mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+  neg_threshold, 
pos_threshold);
+// Wait GPU kernel to complete
+ctx.get_stream()->Wait();
+  }, from.ctx(), {from.var()}, {ret.var(), res.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeGPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+} else {
+  LOG(FATAL) << "unknown device mask";
+}
+#else
+LOG(FATAL) << MXNET_GPU_NOT_ENABLED_ERROR;
+#endif
+  }
+}
+
+void Dequantize(const NDArray , NDArray *to, const std::string& compress, 
int priority) {
+  CHECK(from.shape().ndim() != 0)
+<< "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, ret](RunContext ctx) {
+std::vector inputs(2);
+inputs[0] = from.data();
+inputs[1] = ret.data();
+mxnet::ndarray::Dequantize2BitDispatch(ctx.get_stream(), 
inputs);
+  }, from.ctx(), {from.var()}, {ret.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("DequantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported dequantization " << compress << std::endl;
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
+  if (compress == "2bit") {
 
 Review comment:
   It would be uch more efficient to compare with a scalar enum value


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832653
 
 

 ##
 File path: src/ndarray/ndarray_function.cu
 ##
 @@ -202,5 +203,22 @@ void ElementwiseSum(mshadow::Stream* s,
   }
 }
 
+/*
+ * \brief Enables use of function defined under Dequantize2Bit operator for an 
ndarray
 
 Review comment:
   ?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832885
 
 

 ##
 File path: src/operator/contrib/two_bit_quantize-inl.h
 ##
 @@ -0,0 +1,340 @@
+/*
+ * 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 two_bit_quantize-inl.h
+  * \brief implementation of quantize_2bit operation
+  */
+#ifndef MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+#define MXNET_OPERATOR_CONTRIB_TWO_BIT_QUANTIZE_INL_H_
+
+#include 
+#include 
+#include 
+#include "../elemwise_op_common.h"
+#include "../mshadow_op.h"
+#include "../mxnet_op.h"
+
+namespace mxnet {
+namespace op {
+
+struct init_mem_2bit {
+  // Initialize output array
+  MSHADOW_XINLINE static void Map(int i, float* out) {
+*(out+i) = 0;
+  }
+};
+
+struct TwoBitParam : public dmlc::Parameter {
+  float pos_threshold, neg_threshold;
+  DMLC_DECLARE_PARAMETER(TwoBitParam) {
+DMLC_DECLARE_FIELD(neg_threshold)
+  .set_default(-0.1)
+  .describe("Threshold to quantize negative values. "
+  "Has to be less than 0");
 
 Review comment:
   Is this requirement validated anywhere?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145832353
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+  std::vector inputs(3);
+  inputs[0] = from.data();
+  inputs[1] = res.data();
+  inputs[2] = ret.data();
+  mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+neg_threshold, 
pos_threshold);
+}, from.ctx(), {from.var()}, {ret.var(), res.var()},
+FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
+  if (compress == "2bit") {
+Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+std::vector inputs(3);
+inputs[0] = from.data();
+inputs[1] = res.data();
+inputs[2] = ret.data();
+mxnet::ndarray::Quantize2BitDispatch(ctx.get_stream(), 
inputs,
+  neg_threshold, 
pos_threshold);
+// Wait GPU kernel to complete
+ctx.get_stream()->Wait();
+  }, from.ctx(), {from.var()}, {ret.var(), res.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("QuantizeGPU"));
+} else {
+  LOG(FATAL) << "Unsupported Quantization";
+}
+} else {
+  LOG(FATAL) << "unknown device mask";
+}
+#else
+LOG(FATAL) << MXNET_GPU_NOT_ENABLED_ERROR;
+#endif
+  }
+}
+
+void Dequantize(const NDArray , NDArray *to, const std::string& compress, 
int priority) {
+  CHECK(from.shape().ndim() != 0)
+<< "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, ret](RunContext ctx) {
+std::vector inputs(2);
+inputs[0] = from.data();
+inputs[1] = ret.data();
+mxnet::ndarray::Dequantize2BitDispatch(ctx.get_stream(), 
inputs);
+  }, from.ctx(), {from.var()}, {ret.var()},
+  FnProperty::kNormal, priority, PROFILER_MESSAGE("DequantizeCPU"));
+} else {
+  LOG(FATAL) << "Unsupported dequantization " << compress << std::endl;
+}
+  } else {
+#if MXNET_USE_CUDA
+if (a == gpu::kDevMask && b == gpu::kDevMask) {
 
 Review comment:
   combined with above else as else if{ ... } else { LOG(FATA).. } ?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145831668
 
 

 ##
 File path: src/ndarray/ndarray.cc
 ##
 @@ -558,6 +558,101 @@ void CopyFromTo(const NDArray& from, const NDArray& to, 
int priority) {
   }
 }
 
+void Quantize(const NDArray , NDArray *to, NDArray *residual, const 
std::string& compress,
+  const float neg_threshold, const float pos_threshold,
+  int priority) {
+  CHECK(from.shape().ndim() != 0)
+  << "source operands have zero dimension shape";
+  // important: callback must always capture by value
+  NDArray ret = *to;
+  NDArray res = *residual;
+  int a = from.ctx().dev_mask();
+  int b = to->ctx().dev_mask();
+  if (a == cpu::kDevMask && b == cpu::kDevMask) {
+if (compress == "2bit") {
+  Engine::Get()->PushSync([from, res, ret, neg_threshold, 
pos_threshold](RunContext ctx) {
+  std::vector inputs(3);
 
 Review comment:
   It will be more efficient to initialize as { from.data(), res.data(), 
ret.data() }, since this won't cause TBlob() constructor to be called three 
times when the initial size of the vector is set.


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


With regards,
Apache Git Services


[GitHub] kpot commented on issue #8337: mx.autograd.grad works or fails depending on use of slices

2017-10-19 Thread GitBox
kpot commented on issue #8337: mx.autograd.grad works or fails depending on use 
of slices
URL: 
https://github.com/apache/incubator-mxnet/issues/8337#issuecomment-338047855
 
 
   @piiswrong Is there any better way to get the graph/symbol from autograd? 
Because the method I use seems logical to me: I did forward propagation, then I 
launched back-propagation, then I saved the graph, so now I can re-use it again 
without the need of recording it. I know, it's not very flexible, but I have a 
reason for that.
   
   I'm trying to get the graph explicitly because I want to use nnvm to compile 
and run this graph on an OpenCL device. Currently nnvm-mxnet frontend supports 
only forward-propagating `HybridBlock`s or mxnet.symbol -based graphs. That's 
why I'm trying to get the last one.


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145830977
 
 

 ##
 File path: src/kvstore/kvstore_local.h
 ##
 @@ -135,6 +135,13 @@ class KVStoreLocal : public KVStore {
 PullRowSparseImpl(keys, val_rowids, priority);
   }
 
+  void SetCompress(const std::string& compress, const float neg_threshold,
+   const float pos_threshold) override {
+compress_ = compress;
+pos_threshold_ = pos_threshold;
 
 Review comment:
   Should there be a check that neg_threshold_ is, indeed, smaller than 
pos_threashold?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145830977
 
 

 ##
 File path: src/kvstore/kvstore_local.h
 ##
 @@ -135,6 +135,13 @@ class KVStoreLocal : public KVStore {
 PullRowSparseImpl(keys, val_rowids, priority);
   }
 
+  void SetCompress(const std::string& compress, const float neg_threshold,
+   const float pos_threshold) override {
+compress_ = compress;
+pos_threshold_ = pos_threshold;
 
 Review comment:
   Should ther ebe a check that neg_threshold_ is, indeed, smaller than 
pos_threashold?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145830772
 
 

 ##
 File path: src/kvstore/kvstore_local.h
 ##
 @@ -135,6 +135,13 @@ class KVStoreLocal : public KVStore {
 PullRowSparseImpl(keys, val_rowids, priority);
   }
 
+  void SetCompress(const std::string& compress, const float neg_threshold,
 
 Review comment:
   nit: Does the name "SetCompression()" make more sense?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145830615
 
 

 ##
 File path: src/kvstore/kvstore_dist_server.h
 ##
 @@ -428,20 +468,42 @@ class KVStoreDistServer {
   }
 
   /**
-   * \brief user defined
+   * \brief user defined mode for push
*/
   bool sync_mode_;
   KVStore::Controller controller_;
   KVStore::Updater updater_;
 
+  /**
+   * \brief store_ contains the value at kvstore for each key
+   */
   std::unordered_map store_;
+
+  /**
+   * \brief merge_buf_ is a buffer used if sync_mode is true. It represents
+   * values from different workers being merged. The store will be updated
+   * to this value when values from all workers are pushed into this buffer.
+   */
   std::unordered_map merge_buf_;
 
+  /**
+   * \brief decomp_buf_ is a buffer into which compressed values are
+   * decompressed before merging to the store. used when compress_!='none'
+   */
+  std::unordered_map decomp_buf_;
+
   Executor exec_;
   ps::KVServer* ps_server_;
 
   // whether to LOG verbose information
   bool log_verbose_;
+
+  /**
+   * \brief compress_ refers to whether values sent to kvstore server are
+   * in quantized form. It can be 'none' or '2bit' for now. This is set
+   * by worker by sending a command to server
+   */
+  std::string compress_ = "none";
 
 Review comment:
   How often is this accessed? Would it be more efficient to convert the 
initial string to an enum?


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
cjolivier01 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145830311
 
 

 ##
 File path: src/kvstore/comm.h
 ##
 @@ -79,8 +79,35 @@ class Comm {
 return pinned_ctx_;
   }
 
+  /**
+   * \brief Sets gradient compression parameters to be able to
+   * perform reduce with compressed gradients
+   */
+  inline void SetCompress(const std::string& compress,
 
 Review comment:
   nit: formatting


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8337: mx.autograd.grad works or fails depending on use of slices

2017-10-19 Thread GitBox
piiswrong commented on issue #8337: mx.autograd.grad works or fails depending 
on use of slices
URL: 
https://github.com/apache/incubator-mxnet/issues/8337#issuecomment-338043714
 
 
   Looks like it might be a bug. I'll look into it.
   
   But getting the symbol from a autograd NDArray and binding it is not 
recommended. 


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


With regards,
Apache Git Services


[GitHub] piiswrong commented on issue #8312: Gradient function not returning enough gradients

2017-10-19 Thread GitBox
piiswrong commented on issue #8312: Gradient function not returning enough 
gradients
URL: 
https://github.com/apache/incubator-mxnet/issues/8312#issuecomment-338040865
 
 
   Fixed here https://github.com/apache/incubator-mxnet/pull/8322
   


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


With regards,
Apache Git Services


[GitHub] rahul003 commented on a change in pull request #8342: [WIP] 2bit gradient compression

2017-10-19 Thread GitBox
rahul003 commented on a change in pull request #8342: [WIP] 2bit gradient 
compression
URL: https://github.com/apache/incubator-mxnet/pull/8342#discussion_r145826758
 
 

 ##
 File path: python/mxnet/kvstore.py
 ##
 @@ -349,6 +349,101 @@ def row_sparse_pull(self, key, out=None, priority=0, 
row_ids=None):
 check_call(_LIB.MXKVStorePullRowSparse(
 self.handle, mx_uint(len(ckeys)), ckeys, cvals, crow_ids, 
ctypes.c_int(priority)))
 
+def set_compress(self, compress_params=None):
+""" Specifies type of low-bit quantization for gradient compression if 
any,
+ and additional arguments depending on the type of compression being 
used.
+
+Parameters
+--
+compress_params : dict
+`compress_params` is a dictionary specifying the type and 
parameters
+for gradient compression. The key `compress` in this dictionary is 
a required argument
+and specifies the type of gradient compression. Other keys in this
+dictionary are optional and specific to the type of gradient 
compression.
+
+2bit Gradient Compression
+-
+2bit gradient compression takes two thresholds, one for positive 
values and
+other for negative thresholds. This works by limiting positive 
values in the
+gradient to the positive threshold, and limiting negative values 
to the
+negative threshold. Values which don't meet the thresholds are set 
to 0.
+By doing so, each value in the gradient is in one of three states. 
2bits are
+used to represent these states, and every 16 float values in the 
original
+gradient can be represented using one float. This compressed 
representation
+can reduce communication costs. The difference between these 
values and
+original values is stored at the sender's end as residual and 
added to the
+gradient in the next iteration.
+
+When kvstore is 'local', gradient compression is used to reduce 
communication
+between multiple devices (gpus). Gradient is quantized on each GPU 
which
+computed the gradients, then sent to the GPU which merges the 
gradients. This
+receiving GPU dequantizes the gradients and merges them. Note that 
this
+increases memory usage on each GPU because of the residual array 
stored.
+
+When kvstore is 'dist', gradient compression is used to reduce 
communication
+from worker to sender. Gradient is quantized on each worker which
+computed the gradients, then sent to the server which dequantizes
+this data and merges the gradients from each worker. Note that this
+increases CPU memory usage on each worker because of the residual 
array stored.
+Only worker to server communication is compressed in this setting.
+If each machine has multiple GPUs, currently this GPU to GPU 
communication is
+not compressed. Server to worker communication (in the case of 
pull) is also not
+compressed.
+
+To use 2bit compression, we need to specify `compress` as `2bit`.
+Only specifying `compress` would use default values
+for the other arguments of thresholds.
+To completely specify the arguments for 2bit compression, we would 
need to pass
+a dictionary which includes `positive_threshold` and 
`negative_threshold` like:
+{'compress':'2bit', 'positive_threshold':0.5, 
'negative_threshold':-0.5}
+compress: str
+type of low-bit quantization to be used for gradient 
compression
+Can only be '2bit' for now.
+2bit gradient compression uses 2bit quantization with residual 
to compress
+gradients. It works by converts each value in the original 
gradient to use
+2 bits, causing size of gradient to be 1/16th of the original 
gradient
+(and 3 floats of meta information).
+pos_threshold: float
+positive threshold used for 2bit quantization of gradients
+Positive values in gradient above positive threshold will be 
set to
+positive threshold. Positive values lesser than positive 
threshold will
+be set to 0.
+neg_threshold: float
+negative threshold used for 2bit quantization of gradients
+Negative values in gradient less than negative threshold will 
be set to
+negative threshold. Negative values greater than negative 
threshold will
+be set to 0.
+"""
+compress_params = compress_params if compress_params else 
{'compress':'none'}
+if 'compress' not in compress_params:
+raise ValueError('compress_params requires 

[GitHub] cjolivier01 opened a new pull request #8351: Allow test to converge

2017-10-19 Thread GitBox
cjolivier01 opened a new pull request #8351: Allow test to converge
URL: https://github.com/apache/incubator-mxnet/pull/8351
 
 
   ## Description ##
   (Brief description on what this PR is about)
   
   ## Checklist ##
   ### Essentials ###
   - [ ] Passed code style checking (`make lint`)
   - [ ] Changes are complete (i.e. I finished coding on this PR)
   - [ ] All changes have test coverage
   - [ ] For user-facing API changes, API doc string has been updated.
   - [ ] To my best knowledge, examples are either not affected by this change, 
or have been fixed to be compatible with this change
   
   ### Changes ###
   - [ ] Feature1, tests, (and when applicable, API doc)
   - [ ] Feature2, tests, (and when applicable, API doc)
   
   ## Comments ##
   - If this change is a backward incompatible change, why must this change be 
made.
   - Intersting 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] reminisce commented on issue #8292: mx.nd.array indexing broken in armv7 / raspberrypi / jessie 8.0 (5 dimensional tensor)

2017-10-19 Thread GitBox
reminisce commented on issue #8292: mx.nd.array indexing broken in armv7 / 
raspberrypi / jessie 8.0 (5 dimensional tensor)
URL: 
https://github.com/apache/incubator-mxnet/issues/8292#issuecomment-338034856
 
 
   @larroy Yes, there is a high chance that something went wrong in the op's 
backend implementation on arm devices. Can you run gdb to find out the root 
cause on your device? Or you can printing statements in the code to output 
intermediate information.


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on issue #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on issue #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#issuecomment-338025849
 
 
   'full' on the radar?  that struct isn't used.  if someone wants to use it, 
they can add it.  I am not going to add an unused kernel.  
OpBase::set_to_scalar is available.


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


With regards,
Apache Git Services


[GitHub] cjolivier01 commented on issue #8340: Fill optimizations

2017-10-19 Thread GitBox
cjolivier01 commented on issue #8340: Fill optimizations
URL: https://github.com/apache/incubator-mxnet/pull/8340#issuecomment-338025849
 
 
   'full' on the radar?  that struct isn't used.  if someone wants to use it, 
they can add it.  I am not going to add an unused kernel.


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


With regards,
Apache Git Services


[GitHub] benqua commented on issue #8297: [scala] Make accuracy idependant of output size (fix #8226)

2017-10-19 Thread GitBox
benqua commented on issue #8297: [scala] Make accuracy idependant of output 
size (fix #8226)
URL: https://github.com/apache/incubator-mxnet/pull/8297#issuecomment-338018171
 
 
   @javelinjs ok, I updated the PR as you suggested. 
   (I should maybe have done a new one because the comment thread is now 
difficult to understand)
   What do you think?


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #8350: Incorrect implied shape inside loss function

2017-10-19 Thread GitBox
nickeleres commented on issue #8350: Incorrect implied shape inside loss 
function
URL: 
https://github.com/apache/incubator-mxnet/issues/8350#issuecomment-338004788
 
 
   @pluskid closed a similar unresolved issue
   
   https://github.com/apache/incubator-mxnet/issues/880
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8259: check_format of ndrray, mainly for csr

2017-10-19 Thread GitBox
ZiyueHuang commented on a change in pull request #8259: check_format of ndrray, 
mainly for csr
URL: https://github.com/apache/incubator-mxnet/pull/8259#discussion_r145793132
 
 

 ##
 File path: tests/python/unittest/test_sparse_ndarray.py
 ##
 @@ -647,7 +647,20 @@ def test_sparse_nd_exception():
  (2,2), shape=(3,2))
 assert_exception(mx.nd.sparse.zeros, ValueError,
  "invalid_stype", (2,2))
-
+stypes = ["csr", "row_sparse"]
+for stype in stypes:
+a.tostype(stype).check_format()
+try:
+shape = (3, 4)
+data_list = [7, 8, 9]
+indices_list = [0, 2, 1]
+indptr_list = [0, 5, 2, 3]
+a = mx.nd.sparse.csr_matrix((data_list, indices_list, indptr_list), 
shape)
+a.check_format()
+assert(False)
 
 Review comment:
   More rsp checks are added.


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


With regards,
Apache Git Services


[GitHub] nickeleres opened a new issue #8350: Implied shape when calculating loss is incorrect

2017-10-19 Thread GitBox
nickeleres opened a new issue #8350: Implied shape when calculating loss is 
incorrect
URL: https://github.com/apache/incubator-mxnet/issues/8350
 
 
   Ive seen this brought up in a couple other issues, but it hasnt been 
resolved as far as I know.  
   
   The data I am feeding into my loss function is of the following shape (batch 
size 32):
   
   ```
   output.shape (32L, 51L)
   label.shape (32L, 51L)
   ```
   
   When the `output` and `label` are fed into the loss function, tho, I get the 
following error:
   
   `MXNetError: Shape inconsistent, Provided=(32,51), inferred shape=(32,1)`
   
   Why is the loss function implying an incorrect shape?  In the line above 
said loss function, Gluon knows the correct shape of each input matrix, but the 
loss function auto-implies the shape incorrectly.


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


With regards,
Apache Git Services


[GitHub] nickeleres commented on issue #4045: inferred shape error with FullyConnected layer

2017-10-19 Thread GitBox
nickeleres commented on issue #4045: inferred shape error with FullyConnected 
layer
URL: 
https://github.com/apache/incubator-mxnet/issues/4045#issuecomment-337983895
 
 
   I am having the same issue, where it thinks my weight matrix should be shape 
(N, 1)


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8292: mx.nd.array indexing broken in armv7 / raspberrypi / jessie 8.0 (5 dimensional tensor)

2017-10-19 Thread GitBox
larroy commented on issue #8292: mx.nd.array indexing broken in armv7 / 
raspberrypi / jessie 8.0 (5 dimensional tensor)
URL: 
https://github.com/apache/incubator-mxnet/issues/8292#issuecomment-337971985
 
 
   I think the problem must be in array slicing inside the native lib. I have 
debugged the python code and the call to slice is exactly the same in mac and 
arm:
   addressing a[0,0] calls
   op.slice(handle, begin=[0,0], end=[1,1])
   in ndarray/ndarray.py:570


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to 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 #8292: mx.nd.array indexing broken in armv7 / raspberrypi / jessie 8.0 (5 dimensional tensor)

2017-10-19 Thread GitBox
larroy commented on issue #8292: mx.nd.array indexing broken in armv7 / 
raspberrypi / jessie 8.0 (5 dimensional tensor)
URL: 
https://github.com/apache/incubator-mxnet/issues/8292#issuecomment-337971985
 
 
   I think the problem must be in array slicing inside the native lib. I have 
debugged the python code and the call to slice is exactly the same in mac and 
arm:
   addressing a[0,0] calls
   op.slice(handle, begin=[0,0], end=[1,1])
   


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


With regards,
Apache Git Services


[GitHub] wzhang1 commented on issue #8335: Performance of MXNet on Windows is lower than that on Linux by 15%-20%

2017-10-19 Thread GitBox
wzhang1 commented on issue #8335: Performance of MXNet on Windows  is lower 
than that on Linux by 15%-20%
URL: 
https://github.com/apache/incubator-mxnet/issues/8335#issuecomment-337967220
 
 
   I've seen some cudnn example slower in windows than linux, then gave up 
windows, is this a mxnet 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] tdomhan commented on issue #8334: Bugfix: Python 3 compatiblity during optimizer serialization.

2017-10-19 Thread GitBox
tdomhan commented on issue #8334: Bugfix: Python 3 compatiblity during 
optimizer serialization.
URL: https://github.com/apache/incubator-mxnet/pull/8334#issuecomment-337964938
 
 
   sounds good. I updated the 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] cjolivier01 commented on issue #8343: [CMAKE] Cmake changes, upgrade training test so it converge

2017-10-19 Thread GitBox
cjolivier01 commented on issue #8343: [CMAKE] Cmake changes, upgrade training 
test so it converge
URL: https://github.com/apache/incubator-mxnet/pull/8343#issuecomment-337963496
 
 
   Triggered a rebuild attempt due to CI problems


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


With regards,
Apache Git Services


[GitHub] ShownX opened a new issue #8349: [New features] bincounts

2017-10-19 Thread GitBox
ShownX opened a new issue #8349: [New features] bincounts
URL: https://github.com/apache/incubator-mxnet/issues/8349
 
 
   Ask for bincount function of ndarray, right now I only can use function from 
numpy, from #8193 


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


With regards,
Apache Git Services


[GitHub] mseeger commented on issue #8323: clean up math operators

2017-10-19 Thread GitBox
mseeger commented on issue #8323: clean up math operators
URL: https://github.com/apache/incubator-mxnet/pull/8323#issuecomment-337948535
 
 
   Hi Eric, I did some test to confirm that this solution works.
   
   Please do merge it in. Otherwise, if you are too busy, I can take it over.
   
   I'd like to do some further modification on top of 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] qiliux opened a new issue #8348: mxnet.gluon.data.vision.ImageRecordDataset key error

2017-10-19 Thread GitBox
qiliux opened a new issue #8348: mxnet.gluon.data.vision.ImageRecordDataset key 
error
URL: https://github.com/apache/incubator-mxnet/issues/8348
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues.
   
   If the issue is non-technical, feel free to present the information in what 
you believe is the best form.
   
   ## Description
   (Brief description of the problem in no more than 2 sentences.)
   ```
   The gluon interface is so amazing so that i love it. But when i try to train 
my own dataset, error occurs.
   use the mxnet.gluon.data.vision.ImageRecordDataset, return key error
   ```
   ## Environment info (Required)
   Python3, ubuntu64, gpu version
   ```
   What to do:
   1. Download the diagnosis script from 
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   2. Run the script using `python diagnose.py` and paste its output here.
   --Python Info--
   Version  : 3.6.2
   Compiler : GCC 7.2.0
   Build: ('default', 'Sep 22 2017 02:03:08')
   Arch : ('64bit', '')
   Pip Info---
   Version  : 9.0.1
   Directory: 
/home/qiliux/anaconda3/envs/mxnet/lib/python3.6/site-packages/pip
   --MXNet Info---
   Version  : 0.11.1
   Directory: 
/home/qiliux/anaconda3/envs/mxnet/lib/python3.6/site-packages/mxnet
   Commit Hash   : 3e3ac4c9b481b25fffae5d360125a477ba0a9ce2
   --System Info--
   Platform : Linux-4.10.0-32-generic-x86_64-with-debian-stretch-sid
   system   : Linux
   node : cbw-server
   release  : 4.10.0-32-generic
   version  : #36~16.04.1-Ubuntu SMP Wed Aug 9 09:19:02 UTC 2017
   --Hardware Info--
   machine  : x86_64
   processor: x86_64
   Architecture:  x86_64
   CPU op-mode(s):32-bit, 64-bit
   Byte Order:Little Endian
   CPU(s):16
   On-line CPU(s) list:   0-15
   Thread(s) per core:1
   Core(s) per socket:8
   Socket(s): 2
   NUMA node(s):  2
   Vendor ID: GenuineIntel
   CPU family:6
   Model: 79
   Model name:Intel(R) Xeon(R) CPU E5-2620 v4 @ 2.10GHz
   Stepping:  1
   CPU MHz:   2942.230
   CPU max MHz:   3000.
   CPU min MHz:   1200.
   BogoMIPS:  4189.96
   Virtualization:VT-x
   L1d cache: 32K
   L1i cache: 32K
   L2 cache:  256K
   L3 cache:  20480K
   NUMA node0 CPU(s): 0-7
   NUMA node1 CPU(s): 8-15
   Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss
ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts 
rep_good nopl xtopology nonstop_tsc aperfmperf pni pclmul
   qdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid 
dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_time
   r aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 
intel_ppin intel_pt tpr_shadow vnmi flexpriority ept vpid fs
   gsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm rdt_a rdseed 
adx smap xsaveopt cqm_llc cqm_occup_llc cqm_mbm_total cq
   m_mbm_local dtherm ida arat pln pts
   --Network Test--
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0017 
sec, LOAD: 1.6348 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.2842 sec, LOAD: 
0.7031 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.5301 sec, LOAD: 
1.5949 sec.
   Timing for FashionMNIST: 
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ub
   yte.gz, DNS: 0.5958 sec, LOAD: 2.0139 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0008 sec, LOAD: 
1.6546 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0009 sec, 
LOAD: 1.1777 sec.
   ```
   
   Package used (Python/R/Scala/Julia):
   (I'm using ...)
   Python
   For Scala user, please provide:
   1. Java version: (`java -version`)
   2. Maven version: (`mvn -version`)
   3. Scala runtime if applicable: (`scala -version`)
   
   For R user, please provide R `sessionInfo()`:
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   
   MXNet commit hash:
   (Paste the output of `git rev-parse HEAD` here.)
   
   Build config:
   (Paste the content of config.mk, or the build command.)
   
   ## Error Message:
   ```
   (Paste the complete error message, including stack trace.)
   
   
   KeyError  Traceback (most recent call last)
in ()
 4 
 5 for e in range(epochs):
   > 6 

[GitHub] larroy commented on issue #8231: [MXNet 0.11.0 + RPi 3 + Python 2.7] ndarray unit test fails

2017-10-19 Thread GitBox
larroy commented on issue #8231: [MXNet 0.11.0 + RPi 3 + Python 2.7] ndarray 
unit test fails
URL: 
https://github.com/apache/incubator-mxnet/issues/8231#issuecomment-337896318
 
 
   Duplicate of https://github.com/apache/incubator-mxnet/issues/8292
   


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


With regards,
Apache Git Services


[GitHub] agataradys commented on issue #8291: Import error in SSD example

2017-10-19 Thread GitBox
agataradys commented on issue #8291: Import error in SSD example
URL: 
https://github.com/apache/incubator-mxnet/issues/8291#issuecomment-337885455
 
 
   @edmBernard Thank you, this solution worked. Are you going to fix this 
example to work on both Python versions? Do you still support Python2?


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


With regards,
Apache Git Services


[GitHub] novioleo commented on issue #8151: Amalgamation for android arm64 was built successfully but failed to run in device

2017-10-19 Thread GitBox
novioleo commented on issue #8151: Amalgamation for android arm64 was built 
successfully but failed to run in device 
URL: 
https://github.com/apache/incubator-mxnet/issues/8151#issuecomment-337869571
 
 
   @zhenglaizhang you have to also add indexedRecordIOSplitter into 
mxnet_predict0.cc


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


With regards,
Apache Git Services


[GitHub] mseeger commented on issue #8338: master branch cannot build on centos 7 with cuda-8.0

2017-10-19 Thread GitBox
mseeger commented on issue #8338: master branch cannot build on centos 7 with 
cuda-8.0
URL: 
https://github.com/apache/incubator-mxnet/issues/8338#issuecomment-337862092
 
 
   The error messages seem to depend on mshadow_op.h only through 
smooth_l1_gradient. And that code is really independent of the changes I did.
   
   Are you sure this worked before my changes?
   
   Another thing: The code for smooth_l1_gradient does not do anything useful 
for integral DType. The error messages are about using it for DType = uint8_t. 
Seems to make very little sense to me.
   


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


With regards,
Apache Git Services


[GitHub] jiarenyf commented on issue #8347: CTC Example Problem

2017-10-19 Thread GitBox
jiarenyf commented on issue #8347: CTC Example Problem
URL: 
https://github.com/apache/incubator-mxnet/issues/8347#issuecomment-337843827
 
 
   @pluskid @thinxer 


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


With regards,
Apache Git Services


[GitHub] gongqiang commented on issue #8189: Feed forward pass memory leaks (using htop)

2017-10-19 Thread GitBox
gongqiang commented on issue #8189: Feed forward pass memory leaks (using htop)
URL: 
https://github.com/apache/incubator-mxnet/issues/8189#issuecomment-337843053
 
 
   thanks for the info, but my memory still keep increasing when speed is too 
fast(like 140 sample/s) ^_^ @kazizzad 


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


With regards,
Apache Git Services


[GitHub] jiarenyf opened a new issue #8347: CTC Example Problem

2017-10-19 Thread GitBox
jiarenyf opened a new issue #8347: CTC Example Problem
URL: https://github.com/apache/incubator-mxnet/issues/8347
 
 
   Note: Providing complete information in the most concise form is the best 
way to get help. This issue template serves as the checklist for essential 
information to most of the technical issues.
   
   If the issue is non-technical, feel free to present the information in what 
you believe is the best form.
   
   ## Description
   (Brief description of the problem in no more than 2 sentences.)
   I wonder in 
"https://github.com/apache/incubator-mxnet/blob/f9e25b47c0faec07e940fedb718df2f38dd925b4/example/ctc/lstm.py#L103;,
 if we can delete the line `softmax_loss = mx.sym.MakeLoss(softmax_class)`, and 
use ` softmax_loss = mx.sym.BlockGrad(softmax_class)` direclty ?
   
   That is, I don't know the role of the function "MakeLoss" in this line ?
   
   ## Environment info (Required)
   pip install mxnet-cu80, version 0.11.0
   
   ```
   What to do:
   1. Download the diagnosis script from 
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   2. Run the script using `python diagnose.py` and paste its output here.
   
   ```
   
   Package used (Python/R/Scala/Julia):
   (I'm using ...)
   
   For Scala user, please provide:
   1. Java version: (`java -version`)
   2. Maven version: (`mvn -version`)
   3. Scala runtime if applicable: (`scala -version`)
   
   For R user, please provide R `sessionInfo()`:
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   
   MXNet commit hash:
   (Paste the output of `git rev-parse HEAD` here.)
   
   Build config:
   (Paste the content of config.mk, or the build command.)
   
   ## Error Message:
   (Paste the complete error message, including stack trace.)
   
   ## Minimum reproducible example
   (If you are using your own code, please provide a short script that 
reproduces the error. Otherwise, please provide link to the existing example.)
   
   ## Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1.
   2.
   
   ## What have you tried to solve it?
   
   1.
   2.
   


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


With regards,
Apache Git Services


[GitHub] kazizzad commented on issue #8189: Feed forward pass memory leaks (using htop)

2017-10-19 Thread GitBox
kazizzad commented on issue #8189: Feed forward pass memory leaks (using htop)
URL: 
https://github.com/apache/incubator-mxnet/issues/8189#issuecomment-337834849
 
 
   Hey, are you still running it on the jupyter notebook? if yes,
   use this 
   jupyter nbconvert --to script [YOUR_NOTEBOOK].ipynb
   and run it as python3 DQN.py
   
   I guess the problem was sourced by running it as jupyter notebook.
   (Now I do not have any leak since I am not running it on notebook 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] javelinjs commented on issue #8297: [scala] Make accuracy idependant of output size (fix #8226)

2017-10-19 Thread GitBox
javelinjs commented on issue #8297: [scala] Make accuracy idependant of output 
size (fix #8226)
URL: https://github.com/apache/incubator-mxnet/pull/8297#issuecomment-337832673
 
 
   We can convert it back to Float when calling `EvalMetric.get`


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


With regards,
Apache Git Services


[GitHub] zhenglaizhang commented on issue #8151: Amalgamation for android arm64 was built successfully but failed to run in device

2017-10-19 Thread GitBox
zhenglaizhang commented on issue #8151: Amalgamation for android arm64 was 
built successfully but failed to run in device 
URL: 
https://github.com/apache/incubator-mxnet/issues/8151#issuecomment-337827859
 
 
   @larroy Hi,sorry for late response, thanks for the help, with the help from 
other thread, #4783 i added missing header files and built the so successfully. 
   And I tried the cross build docker, and found the built so was so large, 
around 30M if i remember correctly, and I couldn't run that successfully on 
android device.


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


With regards,
Apache Git Services


[GitHub] zhenglaizhang commented on issue #4783: [v0.9.3] Amalgamation for Android broken

2017-10-19 Thread GitBox
zhenglaizhang commented on issue #4783: [v0.9.3] Amalgamation for Android broken
URL: 
https://github.com/apache/incubator-mxnet/issues/4783#issuecomment-337826814
 
 
   @novioleo yeah, thanks for the info, i succeeded in building the jni so.


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


With regards,
Apache Git Services


[GitHub] gongqiang commented on issue #8189: Feed forward pass memory leaks (using htop)

2017-10-19 Thread GitBox
gongqiang commented on issue #8189: Feed forward pass memory leaks (using htop)
URL: 
https://github.com/apache/incubator-mxnet/issues/8189#issuecomment-337824849
 
 
   I've got the same problem during training; when there is no 'time gap' 
between each mod.forward, backward, update; memory usage keep increasing; but 
when I sleep 0.3s after each 'forward backward update'; memory don't increase 
at all; I think its the matter underlying C++ structure of mxnet that caused 
this problem; still working on how to release the memory fast enough during 
each forward.  


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


With regards,
Apache Git Services


[GitHub] zhreshold commented on issue #8325: Fix typo in gluon l1loss docstring

2017-10-19 Thread GitBox
zhreshold commented on issue #8325: Fix typo in gluon l1loss docstring
URL: https://github.com/apache/incubator-mxnet/pull/8325#issuecomment-337814203
 
 
   Please rebase to master to fix the CI


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


With regards,
Apache Git Services


  1   2   >