You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
Right now there is no way to represent unknown shape in MXNet
According to #14253, now it use -1 instead of 0 as unknown dim. This should only take effect if mx.npx.set_np() is used.
I have the following use case when I want to bind a shape with unknown batch size, and feed different batch size data during forward.
import mxnet as mx
a = mx.sym.Variable("a")
b = mx.sym.Flatten(a)
exec = b.simple_bind(ctx=mx.cpu(), a=(0,10,2))
if give the following error:
Traceback (most recent call last):
File "//anaconda3/lib/python3.7/site-packages/mxnet/symbol/symbol.py", line 1780, in simple_bind
ctypes.byref(exe_handle)))
File "//anaconda3/lib/python3.7/site-packages/mxnet/base.py", line 246, in check_call
raise get_last_ffi_error()
mxnet.base.MXNetError: Traceback (most recent call last):
File "src/executor/../common/exec_utils.h", line 391
MXNetError: InferShape pass cannot decide shapes for the following arguments (-1 means unknown dimensions). Please consider providing them as inputs:
a: [-1,10,2],
But if I use -1, it also fails no matter if set_np() is used.
>>> exec = b.simple_bind(ctx=mx.cpu(), a=(-1, 10,2))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "//anaconda3/lib/python3.7/site-packages/mxnet/symbol/symbol.py", line 1758, in simple_bind
array('I', provided_arg_shape_data)),
OverflowError: can't convert negative value to unsigned int
The text was updated successfully, but these errors were encountered:
I think it still fails for unknow shape case. The above code works fine for 0 dim, but use -1 to represent unknown shape still fails:
>>> with mx.np_shape(active=True):
... a = mx.sym.Variable("a")
... b = mx.sym.Flatten(a)
... exec = b.simple_bind(ctx=mx.cpu(), a=(-1,10,2))
... exec.forward(a=mx.nd.ones((32,10,2)))
...
Traceback (most recent call last):
File "<stdin>", line 4, in <module>
File "//anaconda3/lib/python3.7/site-packages/mxnet/symbol/symbol.py", line 1754, in simple_bind
array('I', provided_arg_shape_data)),
OverflowError: can't convert negative value to unsigned int
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Right now there is no way to represent unknown shape in MXNet
According to #14253, now it use -1 instead of 0 as unknown dim. This should only take effect if
mx.npx.set_np()
is used.I have the following use case when I want to bind a shape with unknown batch size, and feed different batch size data during forward.
if give the following error:
But if I use -1, it also fails no matter if set_np() is used.
The text was updated successfully, but these errors were encountered: