Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

foreach operator does not support input's dimension unknown #12470

Closed
roywei opened this issue Sep 6, 2018 · 2 comments · Fixed by #12471
Closed

foreach operator does not support input's dimension unknown #12470

roywei opened this issue Sep 6, 2018 · 2 comments · Fixed by #12471
Labels

Comments

@roywei
Copy link
Member

roywei commented Sep 6, 2018

Description

In mxnet symbol, None shape is not supported, however we can use 0 as placeholder dimensions.
See: #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_partial()

What have you tried to solve it?

removing line 317 works, will open a PR.

@roywei
Copy link
Member Author

roywei commented Sep 6, 2018

@mxnet-label-bot [Symbol]

@vrakesh
Copy link
Contributor

vrakesh commented Sep 6, 2018

@roywei Thank you for reporting the issue and the PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants