You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/11/06 06:42:57 UTC
[GitHub] [incubator-mxnet] feevos opened a new issue #16736: Bug when
iterating over HybridSequential elements
feevos opened a new issue #16736: Bug when iterating over HybridSequential elements
URL: https://github.com/apache/incubator-mxnet/issues/16736
## Description
Dear all, there is a bug when iterating over a HybridSequential treated as a container. This bug depends on the length of the container. If the length is small, the error does not appear. See minimal example below.
### Error Message
---------------------------------------------------------------------------
MXNetError Traceback (most recent call last)
<ipython-input-39-0824e4e4d6c4> in <module>
6 net.hybridize()
7 xx = nd.random.uniform(shape=[7,nfilters,F,F])
----> 8 out = net(xx)
~/.local/lib/python3.6/site-packages/mxnet/gluon/block.py in __call__(self, *args)
691 hook(self, args)
692
--> 693 out = self.forward(*args)
694
695 for hook in self._forward_hooks.values():
~/.local/lib/python3.6/site-packages/mxnet/gluon/block.py in forward(self, x, *args)
1146 'Find all contexts = {}'.format(ctx_set))
1147 with ctx:
-> 1148 return self._call_cached_op(x, *args)
1149 with ctx:
1150 try:
~/.local/lib/python3.6/site-packages/mxnet/gluon/block.py in _call_cached_op(self, *args)
979 def _call_cached_op(self, *args):
980 if self._cached_op is None:
--> 981 self._build_cache(*args)
982 assert self._cached_op, "cached op is not None"
983 if self._callback:
~/.local/lib/python3.6/site-packages/mxnet/gluon/block.py in _build_cache(self, *args)
967 flags = [('data_indices', data_indices), ('param_indices', param_indices)] + \
968 self._flags
--> 969 self._cached_op = ndarray.CachedOp(out, flags)
970
971 def _deferred_infer_shape(self, *args):
~/.local/lib/python3.6/site-packages/mxnet/_ctypes/ndarray.py in __init__(self, sym, flags)
134 c_str_array([key for key, _ in flags]),
135 c_str_array([str(val) for _, val in flags]),
--> 136 ctypes.byref(self.handle)))
137
138 def __del__(self):
~/.local/lib/python3.6/site-packages/mxnet/base.py in check_call(ret)
253 """
254 if ret != 0:
--> 255 raise MXNetError(py_str(_LIB.MXGetLastError()))
256
257
MXNetError: [14:27:32] src/core/graph.cc:110: Check failed: it != node2index_.end(): control dep not found in graph
Stack trace:
[bt] (0) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x65928b) [0x7f6e5b82f28b]
[bt] (1) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x8385e68) [0x7f6e6355be68]
[bt] (2) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x8386fe8) [0x7f6e6355cfe8]
[bt] (3) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x8387b70) [0x7f6e6355db70]
[bt] (4) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(+0x389a709) [0x7f6e5ea70709]
[bt] (5) /home/dia021/.local/lib/python3.6/site-packages/mxnet/libmxnet.so(MXCreateCachedOpEx+0x2cf) [0x7f6e5e97d72f]
[bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f6edc06fdae]
[bt] (7) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x22f) [0x7f6edc06f71f]
[bt] (8) /usr/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so(_ctypes_callproc+0x2b4) [0x7f6edc2835c4]
## To Reproduce
A simple example to reproduce the error, in this particular example if the length ```len(kernel_sizes)``` is greater or equal to 7 it produces an error. If it is smaller than 7 the error does not appear.
```Python
class Demo(HybridBlock):
def __init__(self, kernel_sizes = [3]*7,**kwards):
super().__init__(**kwards)
with self.name_scope():
self.net = gluon.nn.HybridSequential()
for k in kernel_sizes:
self.net.add(gluon.nn.Conv2D(32,kernel_size=k,padding=1))
def hybrid_forward(self, F, input):
x = input
for conv in self.net:
x = x + conv(input)
return x
# This reproduces the error.
nfilters=32
F = 256
net = Demo(kernel_sizes=[3]*7) # <=== CHANGE HERE, for length of list < 7 this script runs fine.
net.initialize()
net.hybridize()
xx = nd.random.uniform(shape=[7,nfilters,F,F])
out = net(xx)
```
### Steps to reproduce
Run the script above
## What have you tried to solve it?
I tried adding different inputs to the container, this affected the tolerance in the length in the for loop. I cannot explain it.
## Environment
We recommend using our script for collecting the diagnositc information. Run the following command and paste the outputs below:
```
curl --retry 10 -s https://raw.githubusercontent.com/dmlc/gluon-nlp/master/tools/diagnose.py | python
# paste outputs here
----------Python Info----------
Version : 3.6.8
Compiler : GCC 8.3.0
Build : ('default', 'Oct 7 2019 12:59:55')
Arch : ('64bit', 'ELF')
------------Pip Info-----------
Version : 9.0.1
Directory : /usr/lib/python3/dist-packages/pip
----------MXNet Info-----------
Version : 1.6.0
Directory : /home/dia021/.local/lib/python3.6/site-packages/mxnet
Num GPUs : 1
Commit Hash : 77e8f516e7f3d7d2a6c40387028a82ffd761909c
----------System Info----------
Platform : Linux-4.15.0-66-generic-x86_64-with-Ubuntu-18.04-bionic
system : Linux
node : vpro-fl
release : 4.15.0-66-generic
version : #75-Ubuntu SMP Tue Oct 1 05:24:09 UTC 2019
----------Hardware Info----------
machine : x86_64
processor : x86_64
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Thread(s) per core: 2
Core(s) per socket: 4
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 94
Model name: Intel(R) Core(TM) i7-6920HQ CPU @ 2.90GHz
Stepping: 3
CPU MHz: 2866.413
CPU max MHz: 3800.0000
CPU min MHz: 800.0000
BogoMIPS: 5808.00
Virtualisation: VT-x
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 8192K
NUMA node0 CPU(s): 0-7
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 lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx 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 fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed 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
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0004 sec, LOAD: 0.8517 sec.
Timing for GluonNLP GitHub: https://github.com/dmlc/gluon-nlp, DNS: 0.0001 sec, LOAD: 0.6894 sec.
Timing for GluonNLP: http://gluon-nlp.mxnet.io, DNS: 0.1959 sec, LOAD: 0.4118 sec.
Timing for D2L: http://d2l.ai, DNS: 0.0546 sec, LOAD: 0.4319 sec.
Timing for D2L (zh-cn): http://zh.d2l.ai, DNS: 0.0407 sec, LOAD: 0.3036 sec.
Timing for FashionMNIST: https://repo.mxnet.io/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.1956 sec, LOAD: 0.8657 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0413 sec, LOAD: 1.1598 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0411 sec, LOAD: 0.4481 sec.
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services