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

[MXNet] Operator _zeros inferring shapes failed #15766

Open
giuseppedib opened this issue Aug 6, 2019 · 4 comments
Open

[MXNet] Operator _zeros inferring shapes failed #15766

giuseppedib opened this issue Aug 6, 2019 · 4 comments
Labels

Comments

@giuseppedib
Copy link

Description

The definition of a mx.ndarray, with one of the dimensions set to zero, produces an error in mxnet v1.5.0, while it was working fine in mxnet v1.4.1 .

Environment info

----------Python Info----------
Version      : 3.7.3
Compiler     : Clang 4.0.1 (tags/RELEASE_401/final)
Build        : ('default', 'Mar 27 2019 16:54:48')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 19.2.1
Directory    : /anaconda3/lib/python3.7/site-packages/pip
----------MXNet Info-----------
Version      : 1.5.0
Directory    : /anaconda3/lib/python3.7/site-packages/mxnet
Commit Hash   : 75a9e187d00a8b7ebc71412a02ed0e3ae489d91f
Library      : ['/anaconda3/lib/python3.7/site-packages/mxnet/libmxnet.so']

Steps to reproduce

import mxnet as mx
p = mx.ndarray.zeros(shape=(3,0))

Error Message:

Traceback (most recent call last):
File "", line 1, in
File "/anaconda3/lib/python3.7/site-packages/mxnet/ndarray/utils.py", line 67, in zeros
return _zeros_ndarray(shape, ctx, dtype, **kwargs)
File "/anaconda3/lib/python3.7/site-packages/mxnet/ndarray/ndarray.py", line 3885, in zeros
return _internal._zeros(shape=shape, ctx=ctx, dtype=dtype, **kwargs)
File "", line 34, in _zeros
File "/anaconda3/lib/python3.7/site-packages/mxnet/_ctypes/ndarray.py", line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File "/anaconda3/lib/python3.7/site-packages/mxnet/base.py", line 253, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [16:54:11] src/imperative/./imperative_utils.h:145: Operator _zeros inferring shapes failed.
input shapes:
output shapes:
[3,-1]
operator attributes:
dtype : float32
ctx : cpu(0)
shape : (3, 0)

Stack trace:
[bt] (0) 1 libmxnet.so 0x00000001133fc929 mxnet::op::NDArrayOpProp::~NDArrayOpProp() + 4473
[bt] (1) 2 libmxnet.so 0x000000011497bb1f mxnet::imperative::SetShapeType(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&, mxnet::DispatchMode*) + 8767
[bt] (2) 3 libmxnet.so 0x000000011497883c mxnet::Imperative::Invoke(mxnet::Context const&, nnvm::NodeAttrs const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* > const&) + 716
[bt] (3) 4 libmxnet.so 0x00000001148be48e SetNDInputsOutputs(nnvm::Op const*, std::__1::vector<mxnet::NDArray*, std::__1::allocatormxnet::NDArray* >, std::__1::vector<mxnet::NDArray, std::__1::allocatormxnet::NDArray* >, int, void const*, int*, int, int, void***) + 1582
[bt] (4) 5 libmxnet.so 0x00000001148bf1d0 MXImperativeInvokeEx + 176
[bt] (5) 6 libffi.6.dylib 0x000000010b722884 ffi_call_unix64 + 76

@mxnet-label-bot
Copy link
Contributor

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended labels: Bug

@vdantu
Copy link
Contributor

vdantu commented Aug 6, 2019

@mxnet-label-bot add [Bug]

@ifeherva
Copy link
Contributor

ifeherva commented Nov 8, 2019

I can confirm the bug with version 1.5.1

@sxjscience
Copy link
Member

@reminisce I think shape with 0s are generally not supported in the original ndarray interface. We will need to use the new numpy array in MXNet:

import mxnet as mx
mx.npx.set_np()
p = mx.np.zeros(shape=(3,0))

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

No branches or pull requests

6 participants