sdli1995 opened a new issue #20524:
URL: https://github.com/apache/incubator-mxnet/issues/20524
## Description
(A clear and concise description of what the bug is.)
GRU and RNN layer get error when use_sequence_length is True ,and report
state_cell not found
### Error Message
(Paste the complete error message. Please also include stack trace by
setting environment variable `DMLC_LOG_STACK_TRACE_DEPTH=100` before running
your script.)
```
ValueError: Deferred initialization failed because shape cannot be inferred.
Traceback (most recent call last):
[bt] (99) /opt/local/python-latest/bin/python3.9(+0x1d1bcf)
[0x557502cbabcf]
[bt] (98)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (97) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (96)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x661)
[0x557502c72a41]
[bt] (95)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x103)
[0x557502c08f83]
[bt] (94)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x3e7)
[0x557502c727c7]
[bt] (93)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x103)
[0x557502c08f83]
[bt] (92)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x661)
[0x557502c72a41]
[bt] (91) /opt/local/python-latest/bin/python3.9(+0x1d4cb0)
[0x557502cbdcb0]
[bt] (90) /opt/local/python-latest/bin/python3.9(_PyGen_Send+0x161)
[0x557502cbf561]
[bt] (89)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x52ea)
[0x557502c776ca]
[bt] (88) /opt/local/python-latest/bin/python3.9(_PyGen_Send+0x161)
[0x557502cbf561]
[bt] (87)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x52ea)
[0x557502c776ca]
[bt] (86) /opt/local/python-latest/bin/python3.9(_PyGen_Send+0x161)
[0x557502cbf561]
[bt] (85)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x3e7)
[0x557502c727c7]
[bt] (84) /opt/local/python-latest/bin/python3.9(+0x1d7a63)
[0x557502cc0a63]
[bt] (83) /opt/local/python-latest/bin/python3.9(+0x26e025)
[0x557502d57025]
[bt] (82) /opt/local/python-latest/bin/python3.9(PyEval_EvalCode+0x27)
[0x557502d01e57]
[bt] (81)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalCodeWithName+0x4b)
[0x557502d01eab]
[bt] (80) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (79)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x3e7)
[0x557502c727c7]
[bt] (78)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (77) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (76)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x1252)
[0x557502c73632]
[bt] (75)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (74) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (73)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x3e7)
[0x557502c727c7]
[bt] (72) /opt/local/python-latest/bin/python3.9(+0x1d7a63)
[0x557502cc0a63]
[bt] (71) /opt/local/python-latest/bin/python3.9(+0x26e025)
[0x557502d57025]
[bt] (70) /opt/local/python-latest/bin/python3.9(PyEval_EvalCode+0x27)
[0x557502d01e57]
[bt] (69)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalCodeWithName+0x4b)
[0x557502d01eab]
[bt] (68) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (67)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x5768)
[0x557502c77b48]
[bt] (66)
/opt/local/python-latest/bin/python3.9(_PyObject_MakeTpCall+0x11b)
[0x557502c0872b]
[bt] (65) /opt/local/python-latest/bin/python3.9(+0x2086c9)
[0x557502cf16c9]
[bt] (64)
/opt/local/python-latest/bin/python3.9(_PyObject_Call_Prepend+0x336)
[0x557502c09916]
[bt] (63)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (62) /opt/local/python-latest/bin/python3.9(+0x188c5f)
[0x557502c71c5f]
[bt] (61)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (60) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (59) /opt/local/python-latest/bin/python3.9(+0x1d1dc3)
[0x557502cbadc3]
[bt] (58)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (57) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (56)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (55) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (54) /opt/local/python-latest/bin/python3.9(+0x1d1dc3)
[0x557502cbadc3]
[bt] (53)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (52) /opt/local/python-latest/bin/python3.9(+0x188e08)
[0x557502c71e08]
[bt] (51)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (50) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (49) /opt/local/python-latest/bin/python3.9(+0x1d1dc3)
[0x557502cbadc3]
[bt] (48)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (47) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (46)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (45) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (44) /opt/local/python-latest/bin/python3.9(+0x1d1dc3)
[0x557502cbadc3]
[bt] (43)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (42) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (41)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (40) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (39) /opt/local/python-latest/bin/python3.9(+0x1d1e74)
[0x557502cbae74]
[bt] (38)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (37) /opt/local/python-latest/bin/python3.9(+0x188e08)
[0x557502c71e08]
[bt] (36)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (35) /opt/local/python-latest/bin/python3.9(PyObject_Call+0x1d2)
[0x557502c0a192]
[bt] (34) /opt/local/python-latest/bin/python3.9(+0x1d1dc3)
[0x557502cbadc3]
[bt] (33)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (32) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (31)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (30) /opt/local/python-latest/bin/python3.9(PyObject_Call+0xbc)
[0x557502c0a07c]
[bt] (29) /opt/local/python-latest/bin/python3.9(+0x1d1bcf)
[0x557502cbabcf]
[bt] (28)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (27) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (26)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (25) /opt/local/python-latest/bin/python3.9(PyObject_Call+0xbc)
[0x557502c0a07c]
[bt] (24) /opt/local/python-latest/bin/python3.9(+0x1d1bcf)
[0x557502cbabcf]
[bt] (23)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (22) /opt/local/python-latest/bin/python3.9(+0x188e08)
[0x557502c71e08]
[bt] (21)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (20) /opt/local/python-latest/bin/python3.9(PyObject_Call+0xbc)
[0x557502c0a07c]
[bt] (19)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (18) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (17)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x3e7)
[0x557502c727c7]
[bt] (16)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (15) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (14)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x304a)
[0x557502c7542a]
[bt] (13) /opt/local/python-latest/bin/python3.9(PyObject_Call+0xbc)
[0x557502c0a07c]
[bt] (12) /opt/local/python-latest/bin/python3.9(+0x1d1bcf)
[0x557502cbabcf]
[bt] (11)
/opt/local/python-latest/bin/python3.9(_PyFunction_Vectorcall+0x19c)
[0x557502c0901c]
[bt] (10) /opt/local/python-latest/bin/python3.9(+0x188861)
[0x557502c71861]
[bt] (9)
/opt/local/python-latest/bin/python3.9(_PyEval_EvalFrameDefault+0x53e3)
[0x557502c777c3]
[bt] (8) /opt/local/python-latest/bin/python3.9(_PyObject_MakeTpCall+0x7e)
[0x557502c0868e]
[bt] (7)
/opt/local/python-latest/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so(+0x8a7e)
[0x7f7a6d632a7e]
[bt] (6)
/opt/local/python-latest/lib/python3.9/lib-dynload/_ctypes.cpython-39-x86_64-linux-gnu.so(+0x1485a)
[0x7f7a6d63e85a]
[bt] (5) /lib/x86_64-linux-gnu/libffi.so.7(+0x640a) [0x7f7a6e2c540a]
[bt] (4) /lib/x86_64-linux-gnu/libffi.so.7(+0x6ff5) [0x7f7a6e2c5ff5]
[bt] (3)
/opt/local/python-latest/lib/python3.9/site-packages/mxnet/libmxnet.so(NNSymbolCompose+0x1c5)
[0x7f79e7d97a55]
[bt] (2)
/opt/local/python-latest/lib/python3.9/site-packages/mxnet/libmxnet.so(nnvm::Symbol::Compose(dmlc::array_view<nnvm::Symbol
const*> const&, std::unordered_map<std::string, nnvm::Symbol const*,
std::hash<std::string>, std::equal_to<std::string>,
std::allocator<std::pair<std::string const, nnvm::Symbol const*> > > const&,
std::string const&)+0x1be5) [0x7f79e7dacbd5]
[bt] (1)
/opt/local/python-latest/lib/python3.9/site-packages/mxnet/libmxnet.so(nnvm::KeywordArgumentMismatch(char
const*, std::vector<std::string, std::allocator<std::string> > const&,
dmlc::array_view<std::string> const&)+0x20c) [0x7f79e7daf87c]
[bt] (0)
/opt/local/python-latest/lib/python3.9/site-packages/mxnet/libmxnet.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x4f)
[0x7f79e2cf8e4f]
[17:57:44] ../3rdparty/tvm/nnvm/src/core/symbolic.cc:90:
Symbol.ComposeKeyword argument name state_cell not found.
Candidate arguments:
[0]data
[1]parameters
[2]state
[3]sequence_length
```
## To Reproduce
(If you developed your own code, please provide a short script that
reproduces the error. For existing examples, please provide link.)
example code
```
import os
os.environ["DMLC_LOG_STACK_TRACE_DEPTH"] = "100"
#os.environ["PYTHONPATH"] = "/home/sdli/work/mxnet/python"
#os.environ["MXNET_LIBRARY_PATH"] =
"/home/sdli/work/mxnet/cmake-build-debug/libmxnet.so"
import mxnet as mx
import numpy as np
from mxnet.gluon.rnn import GRU,LSTM
print(mx.__version__)
ctx = mx.gpu()
x = mx.nd.array(np.ones((2,16,160)),ctx=ctx)
seqlen = mx.nd.array([10,15],ctx=ctx)
net = GRU(num_layers=2,
hidden_size=64,
use_sequence_length = True,
bidirectional=True,
layout="NTC")
net.initialize(ctx=ctx)
#net.hybridize()
y = net(x, sequence_length = seqlen).asnumpy()
print(y)
```
### Steps to reproduce
(Paste the commands you ran that produced the error.)
1.run example code
## What have you tried to solve it?
1.insert a None obj in rnn_args at
[https://github.com/apache/incubator-mxnet/blob/22f927a22c5024821b5c009ccb7ef210341ce8fe/python/mxnet/gluon/rnn/rnn_layer.py#L282](url)
like this
```
if self._use_sequence_length:
if self._mode != "lstm":
states.append(None)
rnn_args = states + [sequence_length]
else:
rnn_args = states
```
## Environment
***We recommend using our script for collecting the diagnostic information
with the following command***
`curl --retry 10 -s
https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
| python3`
<details>
<summary>Environment Information</summary>
```
----------Python Info----------
Version : 3.9.5
Compiler : GCC 9.3.0
Build : ('default', 'Jun 14 2021 20:28:29')
Arch : ('64bit', 'ELF')
------------Pip Info-----------
Version : 21.1.3
Directory : /opt/local/python-latest/lib/python3.9/site-packages/pip
----------MXNet Info-----------
Version : 1.8.0
Directory : /opt/local/python-latest/lib/python3.9/site-packages/mxnet
Commit hash file
"/opt/local/python-latest/lib/python3.9/site-packages/mxnet/COMMIT_HASH" not
found. Not installed from pre-built package or built from source.
Library :
['/opt/local/python-latest/lib/python3.9/site-packages/mxnet/libmxnet.so']
Build features:
✔ CUDA
✔ CUDNN
✔ NCCL
✔ CUDA_RTC
✖ TENSORRT
✔ CPU_SSE
✔ CPU_SSE2
✔ CPU_SSE3
✖ CPU_SSE4_1
✖ CPU_SSE4_2
✖ CPU_SSE4A
✖ CPU_AVX
✖ CPU_AVX2
✔ OPENMP
✖ SSE
✖ F16C
✖ JEMALLOC
✔ BLAS_OPEN
✖ BLAS_ATLAS
✖ BLAS_MKL
✖ BLAS_APPLE
✔ LAPACK
✔ MKLDNN
✔ OPENCV
✖ CAFFE
✖ PROFILER
✔ DIST_KVSTORE
✖ CXX14
✖ INT64_TENSOR_SIZE
✔ SIGNAL_HANDLER
✖ DEBUG
✖ TVM_OP
----------System Info----------
Platform : Linux-5.11.0-25-generic-x86_64-with-glibc2.31
system : Linux
node : sdli-Inspiron-7590
release : 5.11.0-25-generic
version : #27~20.04.1-Ubuntu SMP Tue Jul 13 17:41:23 UTC 2021
----------Hardware Info----------
machine : x86_64
processor : x86_64
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
Address sizes: 39 bits physical, 48 bits virtual
CPU(s): 12
On-line CPU(s) list: 0-11
Thread(s) per core: 2
Core(s) per socket: 6
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 158
Model name: Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Stepping: 10
CPU MHz: 4032.337
CPU max MHz: 4500.0000
CPU min MHz: 800.0000
BogoMIPS: 5199.98
Virtualization: VT-x
L1d cache: 192 KiB
L1i cache: 192 KiB
L2 cache: 1.5 MiB
L3 cache: 12 MiB
NUMA node0 CPU(s): 0-11
Vulnerability Itlb multihit: KVM: Mitigation: VMX disabled
Vulnerability L1tf: Mitigation; PTE Inversion; VMX conditional
cache flushes, SMT vulnerable
Vulnerability Mds: Mitigation; Clear CPU buffers; SMT
vulnerable
Vulnerability Meltdown: Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass
disabled via prctl and seccomp
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and
__user pointer sanitization
Vulnerability Spectre v2: Mitigation; Full generic retpoline, IBPB
conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds: Mitigation; Microcode
Vulnerability Tsx async abort: Not affected
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep
mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe
syscall nx pdpe1gb rdtscp l
m constant_tsc art arch_perfmon pebs bts
rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64
monitor ds_cpl vmx est tm2 ssse3
sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2
x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm
3dnowprefetch cpuid_fault
epb invpcid_single pti ssbd ibrs ibpb stibp
tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep
bmi2 erms invpcid mpx r
dseed adx smap clflushopt intel_pt xsaveopt
xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window
hwp_epp md_clear flush_l1d
----------Network Test----------
Setting timeout: 10
Error open MXNet: https://github.com/apache/incubator-mxnet, <urlopen error
timed out>, DNS finished in 0.012259483337402344 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.3812 sec, LOAD:
0.4582 sec.
Error open Gluon Tutorial(cn): https://zh.gluon.ai, <urlopen error [SSL:
CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired
(_ssl.c:1129)>, DNS finished in 0.158555269241333 sec.
Timing for FashionMNIST:
https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz,
DNS: 0.1977 sec, LOAD: 0.4556 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0094 sec, LOAD:
1.1517 sec.
Error open Conda: https://repo.continuum.io/pkgs/free/, HTTP Error 403:
Forbidden, DNS finished in 0.20690560340881348 sec.
----------Environment----------
KMP_DUPLICATE_LIB_OK="True"
KMP_INIT_AT_FORK="FALSE"
```
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]