apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.76k stars 6.8k forks source link

Perhaps a bug in mx.symbol.UpSampling #13953

Open FCInter opened 5 years ago

FCInter commented 5 years ago

Description

I use mx.symbol.UpSampling. It reports error if I set sample_type to nearest. It works well if I set sample_type to bilinear. In particular, when sample_type='nearest', i.e., the code is as follows: out = mx.symbol.UpSampling(data=data,scale=16,sample_type='nearest') It reports an error saying that Symbol.ComposeKeyword argument name data not found If I change the code as follows: out = mx.symbol.UpSampling(data,scale=16,sample_type='nearest') i.e. I change the data=data to data, it works well. However, if I set sample_type='bilinear', i.e. out = mx.symbol.UpSampling(data=data,scale=16,sample_type='bilinear') No matter I use data=data or data for the first argument, no error is reported. I think this is a bug.

Environment info (Required)

----------Python Info----------
('Version      :', '2.7.12')
('Compiler     :', 'GCC 5.4.0 20160609')
('Build        :', ('default', 'Dec  4 2017 14:50:18'))
('Arch         :', ('64bit', ''))
------------Pip Info-----------
('Version      :', '18.1')
('Directory    :', '/path/to/mx_env/local/lib/python2.7/site-packages/pip')
----------MXNet Info-----------
('Version      :', '1.3.0')
('Directory    :', '/path/to/mx_env/local/lib/python2.7/site-packages/mxnet')
('Commit Hash   :', 'b3be92f4a48bce62a5a8424271871c2f81c8f7f1')
----------System Info----------
('Platform     :', 'Linux-4.4.0-87-generic-x86_64-with-Ubuntu-16.04-xenial')
('system       :', 'Linux')
('node         :', 'B22-C09-G5500-01-GPU')
('release      :', '4.4.0-87-generic')
('version      :', '#110-Ubuntu SMP Tue Jul 18 12:55:35 UTC 2017')
----------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):                88
On-line CPU(s) list:   0-87
Thread(s) per core:    2
Core(s) per socket:    22
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 79
Model name:            Intel(R) Xeon(R) CPU E5-2699A v4 @ 2.40GHz
Stepping:              1
CPU MHz:               2400.093
CPU max MHz:           3600.0000
CPU min MHz:           1200.0000
BogoMIPS:              4801.21
Virtualization:        VT-x
Hypervisor vendor:     vertical
Virtualization type:   full
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              56320K
NUMA node0 CPU(s):     0-21,44-65
NUMA node1 CPU(s):     22-43,66-87

Package used (Python/R/Scala/Julia): Python

Build info (Required if built from source)

Compiler (gcc/clang/mingw/visual studio): gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609

Build config: I use pip install.

Error Message:

  File "code.py", line 1463, in function
    out = mx.symbol.UpSampling(data=data,scale=16,sample_type='nearest')
  File "<string>", line 56, in UpSampling
  File "/mx_env/local/lib/python2.7/site-packages/mxnet/_ctypes/symbol.py", line 135, in _symbol_creator
    s._compose(name=name, **kwargs)
  File "/mx_env/local/lib/python2.7/site-packages/mxnet/symbol/symbol.py", line 482, in _compose
    self.handle, name, num_args, keys, args))
  File "/mx_env/local/lib/python2.7/site-packages/mxnet/base.py", line 252, in check_call
    raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [06:39:22] src/core/symbolic.cc:72: Symbol.ComposeKeyword argument name data not found.
Candidate arguments:
        [0]arg0

Stack trace returned 10 entries:
[bt] (0) /mx_env/local/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x382d4a) [0x7f06d39fcd4a]
[bt] (1) /mx_env/local/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x383381) [0x7f06d39fd381]
[bt] (2) /mx_env/local/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x765440a) [0x7f06dacce40a]
[bt] (3) /mx_env/local/lib/python2.7/site-packages/mxnet/libmxnet.so(+0x7650c16) [0x7f06daccac16]
[bt] (4) /mx_env/local/lib/python2.7/site-packages/mxnet/libmxnet.so(NNSymbolCompose+0x31b) [0x7f06dacb717b]
[bt] (5) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call_unix64+0x4c) [0x7f076f563e40]
[bt] (6) /usr/lib/x86_64-linux-gnu/libffi.so.6(ffi_call+0x2eb) [0x7f076f5638ab]
[bt] (7) /mx_env/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(_ctypes_callproc+0x48f) [0x7f076f7733df]
[bt] (8) /mx_env/lib/python2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so(+0x11d82) [0x7f076f777d82]
[bt] (9) python(PyEval_EvalFrameEx+0x578f) [0x4c15bf]

Minimum reproducible example

(If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)

This example is very small. I put all the examples in the description.

mxnet-label-bot commented 5 years ago

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:

frankfliu commented 5 years ago

@mxnet-label-bot add [Python, Good first issue, bug]

nopattern commented 5 years ago

me too ,version 1.3.1

ifeherva commented 5 years ago

The UpSampling function expects multiple inputs as data however one has to provide how many inputs are to be expected using the num_filter parameter. However the code suggests that it is only taken into consideration if sample_type is nearest unlike what the documentation says (http://mxnet.incubator.apache.org/versions/1.3.1/api/python/symbol/symbol.html#mxnet.symbol.UpSampling)

The current code for parameter parsing expects 2 inputs for bilinear and num_filter for nearest: https://github.com/apache/incubator-mxnet/blob/master/src/operator/nn/upsampling.cc#L127

szha commented 4 years ago

@zhreshold could you take a look and see: