This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
InferShape return false not caught in Symbolic mode #12337
Comments
6 tasks
@mxnet-label-bot [Python, Bug] |
@mxnet-label-bot [Operator] |
I will work on this issue: https://issues.apache.org/jira/browse/MXNET-865 |
@apeforest What's the progress on this one ? |
@piyushghai I don't have the bandwidth to work on this one now. Please label it [Call for contribution] |
There are two scenarios here in which
Line: 191 } else if ((*in_attrs)[0].ndim() == 1) {
CHECK_EQ((*in_attrs)[0].Size(), static_cast<size_t>(tshape[0]));
return true; Correct scenario where the test pass:condition = mx.sym.Variable('condition')
x = mx.sym.Variable('x')
y = mx.sym.Variable('y')
where_sym = mx.sym.where(condition, x, y)
where_sym.eval(x=mx.nd.array([[2,3],[4,5],[6,7]]),
y=mx.nd.array([[8,9],[10,11],[12,13]]),
condition=mx.nd.array([1,0,1])) # 1D array Correct scenario where the test Fails:condition = mx.sym.Variable('condition')
x = mx.sym.Variable('x')
y = mx.sym.Variable('y')
where_sym = mx.sym.where(condition, x, y)
where_sym.eval(x=mx.nd.array([[2,3],[4,5],[6,7]]),
y=mx.nd.array([[8,9],[10,11],[12,13]]),
condition=mx.nd.array([1,0,1,1])) # Incorrect 1D array The 1D array condition is working perfectly as expected in symbolic mode. It throws error if there is a dimension mismatch.
Line: 187 if ((*in_attrs)[0].ndim() == tshape.ndim()) {
if (!shape_assign(&tshape, (*in_attrs)[0])) return false; // This is returning false which is expected behavior when there is dimension mismatch between variable condition and variable x but the script is not asserting. However, it passes which is strange.
SHAPE_ASSIGN_CHECK(*in_attrs, 0, tshape);
return true; In reality, it should throw error something like: mxnet.base.MXNetError: Error in operator where0:
Shape inconsistent, Provided = [1,2], inferred shape=[3,2] I will look into it further in detail. Please feel free to suggest if I am going in the wrong direction. Thanks! |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Description
When the inputs to an operator is invalid, the InferShape in the operator returns false. This return value is not caught and treated properly in Symbolic mode, whereas the imperative mode would raise error.
Environment info (Required)
Package used (Python/R/Scala/Julia):
Python
Minimum reproducible example
The text was updated successfully, but these errors were encountered: