This is an automated email from the ASF dual-hosted git repository.
anirudh2290 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 30b1cbc add exception (#14362)
30b1cbc is described below
commit 30b1cbc1d862f8c5c1f91d0a9f048aef5771f9de
Author: Anirudh <[email protected]>
AuthorDate: Thu Mar 7 19:29:32 2019 -0800
add exception (#14362)
---
src/operator/tensor/init_op.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/operator/tensor/init_op.h b/src/operator/tensor/init_op.h
index 680431d..fe1a1f6 100644
--- a/src/operator/tensor/init_op.h
+++ b/src/operator/tensor/init_op.h
@@ -214,6 +214,11 @@ inline bool InitShape(const nnvm::NodeAttrs& attrs,
CHECK_EQ(in_attrs->size(), 0U);
CHECK_EQ(out_attrs->size(), 1U);
if ((*out_attrs)[0].ndim() != 0 && param.shape.ndim() == 0) return true;
+ for (unsigned int i=0 ; i < param.shape.ndim() ; ++i) {
+ if (param.shape[i] < 0U) {
+ LOG(FATAL) << "Shape cannot contain negative values " << param.shape;
+ }
+ }
SHAPE_ASSIGN_CHECK(*out_attrs, 0, param.shape);
return true;
}