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.
The example for cond operator does not work for NDArray API from the website ([https://mxnet.incubator.apache.org/api/python/ndarray/contrib.html#mxnet.ndarray.contrib.cond])
a, b = mx.nd.array([1]), mx.nd.array([2])
pred = a * b < 5
then_func = lambda a, b: (a + 5) * (b + 5)
else_func = lambda a, b: (a - 5) * (b - 5)
outputs = mx.nd.contrib.cond(pred, then_func, else_func)
outputs[0]
When running this with v1.3.x here is the output:
>>> a, b = mx.nd.array([1]), mx.nd.array([2])
>>> pred = a * b < 5
>>> then_func = lambda a, b: (a + 5) * (b + 5)
>>> else_func = lambda a, b: (a - 5) * (b - 5)
>>> outputs = mx.nd.contrib.cond(pred, then_func, else_func)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/site-packages/mxnet/ndarray/contrib.py", line 460, in cond
return then_func()
TypeError: <lambda>() takes exactly 2 arguments (0 given)
The symbolic API example does work for the cond operator. Is it supposed to work for for the NDArray API? If so, then this is a bug. If not, then the documentation needs to be fixed since its not supported in the NDArray API.
The text was updated successfully, but these errors were encountered:
@zheng-da What is your take on this? Is this supposed to work, or does the documentation need to be removed for cond (and other control flow operators) in the NDArray API?
Description
The example for cond operator does not work for NDArray API from the website ([https://mxnet.incubator.apache.org/api/python/ndarray/contrib.html#mxnet.ndarray.contrib.cond])
When running this with v1.3.x here is the output:
The symbolic API example does work for the cond operator. Is it supposed to work for for the NDArray API? If so, then this is a bug. If not, then the documentation needs to be fixed since its not supported in the NDArray API.
The text was updated successfully, but these errors were encountered: