Incubator-mxnet: mxnet.ndarray.stack : PLEASE UPDATE DOC

Created on 28 Jul 2018  路  5Comments  路  Source: apache/incubator-mxnet

image

This is not how stack is working. Gives the following error when I execute the example pf stack(x,y):-
AssertionError: Positional arguments must have NDArray type, but got [1, 2]

I am using 1.2.

Unclear ErroDoc

Most helpful comment

@y12uc231 all arrays in the doc are (obviously) assumed to be NDArrays... It's even mentioned in your screenshot. So, stop yelling in all-caps in the first place, and try again with NDArrays

All 5 comments

Can you post the exact instructions you used here?
This is what I got:

>>> import mxnet as mx
>>> a = mx.nd.array([1,2])
>>> b = mx.nd.array([3,4])
>>> mx.nd.stack(a, b)

[[ 1.  2.]
 [ 3.  4.]]
<NDArray 2x2 @cpu(0)>

Maybe what you did was:

>>> import mxnet as mx
>>> a = [1,2]
>>> b = [3,4]
>>> mx.nd.stack(a, b)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 39, in stack
AssertionError: Positional arguments must have NDArray type, but got [1, 2]

?

Yup, I did the second thing, which is exactly mentioned in the doc.

@y12uc231 all arrays in the doc are (obviously) assumed to be NDArrays... It's even mentioned in your screenshot. So, stop yelling in all-caps in the first place, and try again with NDArrays

@y12uc231 Hi, thanks for the feedback. Indeed it's not very clear. And even worse, it's a common problem for all operator examples. The problem is that the example is written once, and shown in python/scala/R documentation, so we tried to make it more language agnostic but unfortunately becomes very misleading...

Thanks @liyujiel, he added a Python example for stack now. Closing the issue

Was this page helpful?
0 / 5 - 0 ratings