Skip to content

Commit

Permalink
add exception (apache#14362)
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhacharya authored and vdantu committed Mar 31, 2019
1 parent fe19790 commit 920dd93
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/operator/tensor/init_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 920dd93

Please sign in to comment.