You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ha...@apache.org on 2019/12/25 23:08:06 UTC
[incubator-mxnet] branch master updated: fix norm sparse fallback
(#17149)
This is an automated email from the ASF dual-hosted git repository.
haibin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
The following commit(s) were added to refs/heads/master by this push:
new 2551a9d fix norm sparse fallback (#17149)
2551a9d is described below
commit 2551a9d8c8a4f5fd73c98e56ff79ab5410053d0e
Author: Hao Jin <hj...@gmail.com>
AuthorDate: Thu Dec 26 07:07:30 2019 +0800
fix norm sparse fallback (#17149)
---
src/operator/tensor/broadcast_reduce_norm_value.cc | 2 +-
src/operator/tensor/broadcast_reduce_norm_value.cu | 2 +-
src/operator/tensor/broadcast_reduce_op.h | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/operator/tensor/broadcast_reduce_norm_value.cc b/src/operator/tensor/broadcast_reduce_norm_value.cc
index 4cd92d4..9acc157 100644
--- a/src/operator/tensor/broadcast_reduce_norm_value.cc
+++ b/src/operator/tensor/broadcast_reduce_norm_value.cc
@@ -40,7 +40,7 @@ void L2NormComputeEx<cpu>(const nnvm::NodeAttrs& attrs,
const NormParam& param = nnvm::get<NormParam>(attrs.parsed);
mshadow::Stream<cpu>* s = ctx.get_stream<cpu>();
const NDArrayStorageType istype = inputs[0].storage_type();
- const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape();
+ const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape(0, -1);
if ((istype == kRowSparseStorage || istype == kCSRStorage) && axis.ndim() == 0 &&
param.ord == 2) {
// l2 norm on the entire array
diff --git a/src/operator/tensor/broadcast_reduce_norm_value.cu b/src/operator/tensor/broadcast_reduce_norm_value.cu
index 188c93e..735c3d7 100644
--- a/src/operator/tensor/broadcast_reduce_norm_value.cu
+++ b/src/operator/tensor/broadcast_reduce_norm_value.cu
@@ -39,7 +39,7 @@ void L2NormComputeEx<gpu>(const nnvm::NodeAttrs& attrs,
const NormParam& param = nnvm::get<NormParam>(attrs.parsed);
mshadow::Stream<gpu>* s = ctx.get_stream<gpu>();
const NDArrayStorageType istype = inputs[0].storage_type();
- const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape();
+ const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape(0, -1);
if ((istype == kRowSparseStorage || istype == kCSRStorage) && axis.ndim() == 0 &&
param.ord == 2) {
// l2 norm on the entire array
diff --git a/src/operator/tensor/broadcast_reduce_op.h b/src/operator/tensor/broadcast_reduce_op.h
index 27e2249..799f865 100644
--- a/src/operator/tensor/broadcast_reduce_op.h
+++ b/src/operator/tensor/broadcast_reduce_op.h
@@ -1152,7 +1152,7 @@ inline bool LpNormStorageType(const nnvm::NodeAttrs& attrs,
DispatchMode::kFCompute);
}
if (param.ord == 2) {
- const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape();
+ const mxnet::TShape axis = param.axis.has_value() ? param.axis.value() : mxnet::TShape(0, -1);
if (!dispatched && (in_stype == kRowSparseStorage || in_stype == kCSRStorage) &&
axis.ndim() == 0 && param.ord == 2) {
// l2 norm: rsp/csr, axis = () -> dns