Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shape Error in chapter16_tensor_methods #505

Open
thomelane opened this issue Jun 16, 2018 · 0 comments
Open

Shape Error in chapter16_tensor_methods #505

thomelane opened this issue Jun 16, 2018 · 0 comments

Comments

@thomelane
Copy link
Contributor

When running mxnet-the-straight-dope/chapter16_tensor_methods/tensor_basics.ipynb, all works up until line res = mode_dot(X, M, mode=1) (Cell 18) when get the stack trace below.

---------------------------------------------------------------------------
MXNetError                                Traceback (most recent call last)
<ipython-input-18-59009149ac70> in <module>()
----> 1 res = mode_dot(X, M, mode=1)

<ipython-input-16-55598ff29592> in mode_dot(tensor, matrix_or_vector, mode)
     35 
     36     # refold the result into a tensor and return it
---> 37     return fold(res, fold_mode, new_shape)

<ipython-input-14-1bfd1880eb89> in fold(unfolded_tensor, mode, shape)
     19     mode_dim = full_shape.pop(mode)
     20     full_shape.insert(0, mode_dim)
---> 21     return nd.moveaxis(nd.reshape(unfolded_tensor, full_shape), 0, mode)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/ndarray/register.py in reshape(data, shape, reverse, target_shape, keep_highest, out, name, **kwargs)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py in _imperative_invoke(handle, ndargs, keys, vals, out)
     90         c_str_array(keys),
     91         c_str_array([str(s) for s in vals]),
---> 92         ctypes.byref(out_stypes)))
     93 
     94     if original_output is not None:

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/base.py in check_call(ret)
    147     """
    148     if ret != 0:
--> 149         raise MXNetError(py_str(_LIB.MXGetLastError()))
    150 
    151 

MXNetError: [23:58:13] src/operator/tensor/./matrix_op-inl.h:187: Check failed: oshape.Size() == dshape.Size() (24 vs. 30) Target shape size is different to source. Target: [4,3,2]
Source: [5,6]

Stack trace returned 10 entries:
[bt] (0) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x30cbe2) [0x7f4eb095bbe2]
[bt] (1) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x30d1b8) [0x7f4eb095c1b8]
[bt] (2) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x27cd55f) [0x7f4eb2e1c55f]
[bt] (3) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x29bf312) [0x7f4eb300e312]
[bt] (4) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x29c8dee) [0x7f4eb3017dee]
[bt] (5) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x2900c4b) [0x7f4eb2f4fc4b]
[bt] (6) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/libmxnet.so(MXImperativeInvokeEx+0x6f) [0x7f4eb2f5020f]
[bt] (7) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call_unix64+0x4c) [0x7f4f0c06cec0]
[bt] (8) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/lib-dynload/../../libffi.so.6(ffi_call+0x22d) [0x7f4f0c06c87d]
[bt] (9) /home/ubuntu/anaconda3/envs/mxnet_p36/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2ce) [0x7f4f0c281dee]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant