-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[MXNET-283] Error handling for non-positive reps of tile op #10417
[MXNET-283] Error handling for non-positive reps of tile op #10417
Conversation
src/operator/tensor/matrix_op-inl.h
Outdated
@@ -1462,6 +1463,10 @@ inline bool TileOpShape(const nnvm::NodeAttrs& attrs, | |||
SHAPE_ASSIGN_CHECK(*out_attrs, 0, ishape); | |||
return true; | |||
} | |||
// fix for https://github.com/apache/incubator-mxnet/issues/10288 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to put this in comment
def test_zero_reps(): | ||
a = np.array([[2, 3, 4], [5, 6, 7]], dtype=np.int32) | ||
b = mx.nd.array(a, ctx=default_context(), dtype=a.dtype) | ||
reps = (2, 0, 4, 5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was this supported previously? What was the behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would return an empty NDArray with some dim size equal to zero. I was following the NumPy's convention to implement the behavior. Since MXNet does not support empty NDArrays in any way, I think it's okay to move this to assert_exception
test?
src/operator/tensor/matrix_op-inl.h
Outdated
@@ -1462,6 +1463,10 @@ inline bool TileOpShape(const nnvm::NodeAttrs& attrs, | |||
SHAPE_ASSIGN_CHECK(*out_attrs, 0, ishape); | |||
return true; | |||
} | |||
// fix for https://github.com/apache/incubator-mxnet/issues/10288 | |||
for (size_t i = 0; i < reps.ndim(); ++i) { | |||
CHECK_GT(reps[i], 0) << "invalid reps[" << i << "], dim size must be greater than zero"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"invalid reps=i" instead of "invalid reps[i]"
392e834
to
49e69ad
Compare
@piiswrong is this good to merge ? |
…0417) * Error handling for non-positive reps of tile op * Address cr * Fix unit test
…0417) * Error handling for non-positive reps of tile op * Address cr * Fix unit test
Description
Address this issue.
#10288
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
Comments