taliesinb opened a new issue #12760: Extremely weird shape inference bug in foreach URL: https://github.com/apache/incubator-mxnet/issues/12760 ## Description The foreach subgraph operator is sensitive to what should be irrelevant details of its construction, incorrectly failing when the inputs of a symmetric function are re-ordered. ## Environment info (Required) Package used (Python/R/Scala/Julia): I'm using Python. ## Error Message: The error message is actually incorrect. The graph is shape-correct! ``` infer_shape error. Arguments: a: (1, 3) b: (1,) Traceback (most recent call last): File "Untitled 9.py", line 68, in <module> print(sym.infer_shape(a=(1,3), b=(1,))) File "/Users/taliesinb/.anaconda3/lib/python3.6/site-packages/mxnet-1.3.0-py3.6.egg/mxnet/symbol/symbol.py", line 996, in infer_shape res = self._infer_shape_impl(False, *args, **kwargs) File "/Users/taliesinb/.anaconda3/lib/python3.6/site-packages/mxnet-1.3.0-py3.6.egg/mxnet/symbol/symbol.py", line 1126, in _infer_shape_impl ctypes.byref(complete))) File "/Users/taliesinb/.anaconda3/lib/python3.6/site-packages/mxnet-1.3.0-py3.6.egg/mxnet/base.py", line 255, in check_call raise MXNetError(py_str(_LIB.MXGetLastError())) mxnet.base.MXNetError: Error in operator .: Error in operator mul2: [21:50:42] src/operator/contrib/../tensor/../elemwise_op_common.h:133: Check failed: assign(&dattr, (*vec)[i]) Incompatible attr in node mul2 at 1-th input: expected [3], got [1] ``` ## Minimum reproducible example ``` import mxnet as mx json = """{ "nodes":[ { "op":"null", "name":"a", "inputs":[] }, { "op":"null", "name":"b", "inputs":[] }, { "op":"_foreach", "name":".", "attrs":{ "in_data_locs":"[0]", "in_state_locs":"[]", "num_args":"3", "num_out_data":"1", "num_outputs":"1", "remain_locs":"[1]" }, "inputs":[[0,0,0],[1,0,0]], "subgraphs":[ { "nodes":[ { "op":"null", "name":"inner_a", "inputs":[] }, { "op":"null", "name":"inner_b", "inputs":[] }, { "op":"broadcast_mul", "name":"mul1", "inputs":[[1,0,0],[0,0,0]] }, { "op":"elemwise_mul", "name":"mul2", "inputs":[[2,0,0],[0,0,0]] } ], "arg_nodes":[0,1], "heads":[[3,0,0]] } ] } ], "arg_nodes":[0,1], "heads":[[2,0,0]], "attrs":{ "mxnet_version":[ "int", 10300 ] } }"""; sym = mx.sym.load_json(json) print(sym.infer_shape(a=(1,3), b=(1,))) ``` ## Steps to reproduce Run the above code in Python, you'll get an infer shape error. if you flip the order of inputs in `mul2` from `[[2,0,0],[0,0,0]]` to `[[0,0,0],[2,0,0]]`, shape inference succeeds as expected. ## What have you tried to solve it? I have no idea how to approach solving this.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
