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

Support for zero-dimensional tensors is broken #18271

Closed
arogozhnikov opened this issue May 10, 2020 · 4 comments
Closed

Support for zero-dimensional tensors is broken #18271

arogozhnikov opened this issue May 10, 2020 · 4 comments
Labels

Comments

@arogozhnikov
Copy link
Contributor

Description

Support for zero-dimensional tensors is broken

Error Message

(Paste the complete error message. Please also include stack trace by setting environment variable DMLC_LOG_STACK_TRACE_DEPTH=10 before running your script.)

terminate called after throwing an instance of 'dmlc::Error'
  what():  [06:19:35] src/imperative/./imperative_utils.h:146: Operator _zeros inferring shapes failed.
input shapes:
output shapes:
None
operator attributes:
dtype : float32
ctx : cpu(0)
shape : []

Stack trace:
  [bt] (0) /usr/local/lib/python3.7/site-packages/mxnet/libmxnet.so(+0x307d3b) [0x7f3ee1e63d3b]
  [bt] (1) /usr/local/lib/python3.7/site-packages/mxnet/libmxnet.so(mxnet::imperative::SetShapeType(mxnet::Context const&, nnvm::NodeAttrs const&, std::vector<mxnet::NDArray*, std::allocator<mxnet::NDArray*> > const&, std::vector<mxnet::NDArray*, std::allocator<mxnet::NDArray*> > const&, mxnet::DispatchMode*)+0x363b) [0x7f3ee4fff3bb]

To Reproduce

It can appear in multiple different situations:

import mxnet
x = mxnet.nd.zeros([]) # failure

or

x = mxnet.nd.from_numpy(numpy.zeros([])) # ok, tensor created
x.attach_grad() # failure

Environment

----------Python Info----------
Version      : 3.7.3
Compiler     : GCC 6.3.0 20170516
Build        : ('default', 'Jun 11 2019 01:05:09')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 19.1.1
Directory    : /usr/local/lib/python3.7/site-packages/pip
----------MXNet Info-----------
Version      : 1.6.0
Directory    : /usr/local/lib/python3.7/site-packages/mxnet
Num GPUs     : 0
Commit Hash   : 6eec9da55c5096079355d1f1a5fa58dcf35d6752
----------System Info----------
Platform     : Linux-4.19.76-linuxkit-x86_64-with-debian-9.9
system       : Linux
node         : 0a353fd2b50d
release      : 4.19.76-linuxkit
version      : #1 SMP Thu Oct 17 19:31:58 UTC 2019
----------Hardware Info----------
machine      : x86_64
processor    :
Architecture:          x86_64
CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    1
Socket(s):             4
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 158
Model name:            Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
Stepping:              10
CPU MHz:               2900.000
BogoMIPS:              5808.00
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              12288K
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht pbe syscall nx pdpe1gb lm constant_tsc rep_good nopl xtopology nonstop_tsc cpuid tsc_known_freq pni pclmulqdq dtes64 ds_cpl ssse3 sdbg fma cx16 xtpr pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch pti fsgsbase bmi1 hle avx2 bmi2 erms rtm xsaveopt arat
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0286 sec, LOAD: 0.7676 sec.
Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0016 sec, LOAD: 0.6134 sec.
Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.0497 sec, LOAD: 0.7350 sec.
Timing for D2L: http://d2l.ai, DNS: 0.0560 sec, LOAD: 0.2496 sec.
Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0302 sec, LOAD: 0.1806 sec.
Timing for FashionMNIST: https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1056 sec, LOAD: 0.3243 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0205 sec, LOAD: 0.5132 sec.
Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403: Forbidden, DNS finished in 0.017886877059936523 sec.
@leezu
Copy link
Contributor

leezu commented May 11, 2020

This only works in the #14253 interface, which is still opt-in but will be default in 2.0

@arogozhnikov
Copy link
Contributor Author

@leezu tried with mxnet.numpy.zeros([]) but also got failure.

Both hands for that proposal, BTW.

@sxjscience
Copy link
Member

@arogozhnikov You will need to manually call mx.npx.set_np() to trigger the numpy semantic.

@sxjscience
Copy link
Member

@arogozhnikov I’ll close it for now because I think adding “mx.npx.set_np()” will solve the issue. Feel free to reopen it.

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

3 participants