## Description In mxnet symbol, None shape is not supported, however we can use 0 as placeholder dimensions. See: https://github.com/apache/incubator-mxnet/issues/7981 we can use ``` x = mx.sym.var('x', shape=(0, 100)) ``` instead of ``` x = mx.sym.var('x', shape=(None, 100)) ```
But foreach operator will throw error due to check here: https://github.com/apache/incubator-mxnet/blob/master/src/operator/control_flow.cc#L317 ## Error Message: ``` mxnet.base.MXNetError: Error in operator _foreach4: [11:26:26] src/operator/control_flow.cc:317: Check failed: len > 0 (0 vs. 0) Stack trace returned 8 entries: [bt] (0) 0 libmxnet.so 0x0000000102854640 libmxnet.so + 26176 [bt] (1) 1 libmxnet.so 0x00000001028543ef libmxnet.so + 25583 [bt] (2) 2 libmxnet.so 0x0000000103f61e3f MXTVMBridge + 111375 [bt] (3) 3 libmxnet.so 0x0000000103dda022 MXNDListFree + 333138 [bt] (4) 4 libmxnet.so 0x0000000103dd240f MXNDListFree + 301375 [bt] (5) 5 libmxnet.so 0x0000000103d74a65 MXSymbolInferShape + 2373 [bt] (6) 6 libmxnet.so 0x0000000103d77100 MXSymbolInferShapePartial + 112 [bt] (7) 7 libffi.6.dylib 0x0000000101fc3884 ffi_call_unix64 + 76 ``` ## Minimum reproducible example ``` step = lambda data, states: (data + states[0], [states[0] * 2]) data = mx.sym.var('data', shape=(0,100)) states = [mx.sym.var('state')] outs, states = mx.sym.contrib.foreach(step, data, states) outs.infer_shape() ``` ## What have you tried to solve it? removing [line 317](https://github.com/apache/incubator-mxnet/blob/master/src/operator/control_flow.cc#L317 ) works, will open a PR. [ Full content available at: https://github.com/apache/incubator-mxnet/issues/12470 ] This message was relayed via gitbox.apache.org for [email protected]
