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

Bilinear UpSampling is broken #12970

Closed
safrooze opened this issue Oct 25, 2018 · 2 comments · Fixed by #14919
Closed

Bilinear UpSampling is broken #12970

safrooze opened this issue Oct 25, 2018 · 2 comments · Fixed by #14919

Comments

@safrooze
Copy link
Contributor

safrooze commented Oct 25, 2018

Description

UpSampling with bilinear mode seems to be broken. Also the unittest that is supposed to be testing this upsampling mode isn't properly implemented, so it isn't run (see #4923). This is reported in this discuss question.

Environment info (Required)

----------Python Info----------
Version      : 3.6.3
Compiler     : GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)
Build        : ('default', 'Nov  8 2017 18:10:31')
Arch         : ('64bit', '')
------------Pip Info-----------
Version      : 18.0
Directory    : /Users/safrooze/tools/anaconda3/envs/ipy3/lib/python3.6/site-packages/pip
----------MXNet Info-----------
Version      : 1.3.0
Directory    : /Users/safrooze/tools/anaconda3/envs/ipy3/lib/python3.6/site-packages/mxnet
Commit Hash   : b3be92f4a48bce62a5a8424271871c2f81c8f7f1
----------System Info----------
Platform     : Darwin-16.7.0-x86_64-i386-64bit
system       : Darwin
node         : 8c85904c8831.ant.amazon.com
release      : 16.7.0
version      : Darwin Kernel Version 16.7.0: Thu Jun 21 20:07:39 PDT 2018; root:xnu-3789.73.14~1/RELEASE_X86_64
----------Hardware Info----------
machine      : x86_64
processor    : i386
b'machdep.cpu.extfeatures: SYSCALL XD 1GBPAGE EM64T LAHF LZCNT PREFETCHW RDTSCP TSCI'
b'machdep.cpu.leaf7_features: SMEP ERMS RDWRFSGS TSC_THREAD_OFFSET BMI1 HLE AVX2 BMI2 INVPCID RTM SMAP RDSEED ADX IPT SGX FPU_CSDS MPX CLFSOPT'
b'machdep.cpu.features: FPU VME DE PSE TSC MSR PAE MCE CX8 APIC SEP MTRR PGE MCA CMOV PAT PSE36 CLFSH DS ACPI MMX FXSR SSE SSE2 SS HTT TM PBE SSE3 PCLMULQDQ DTES64 MON DSCPL VMX SMX EST TM2 SSSE3 FMA CX16 TPR PDCM SSE4.1 SSE4.2 x2APIC MOVBE POPCNT AES PCID XSAVE OSXSAVE SEGLIM64 TSCTMR AVX1.0 RDRAND F16C'
b'machdep.cpu.brand_string: Intel(R) Core(TM) i7-7660U CPU @ 2.50GHz'
----------Network Test----------
Setting timeout: 10
Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0171 sec, LOAD: 0.4492 sec.
Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0223 sec, LOAD: 0.2160 sec.
Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0502 sec, LOAD: 0.3344 sec.
Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0314 sec, LOAD: 0.1968 sec.
Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0143 sec, LOAD: 0.3536 sec.
Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0246 sec, LOAD: 0.0713 sec.

Package used:
Python

Error Message:

File “”, line 38, in UpSampling
File “/home/local/ANT/dfferstl/AdnExMXNet/build/private/src/python/mxnet/_ctypes/ndarray.py”, line 92, in _imperative_invoke
ctypes.byref(out_stypes)))
File “/home/local/ANT/dfferstl/AdnExMXNet/build/private/src/python/mxnet/base.py”, line 210, in check_call
raise MXNetError(py_str(_LIB.MXGetLastError()))
mxnet.base.MXNetError: [16:26:52] src/c_api/…/imperative/imperative_utils.h:336: Check failed: num_inputs == infered_num_inputs (1 vs. 2) Operator UpSampling expects 2 inputs, but got 1 instead.

Minimum reproducible example

x = nd.ones((5,1,20,20))
nd.UpSampling(x, scale=2, sample_type='bilinear', num_filter=1)

Steps to reproduce

  1. Run code above
@safrooze
Copy link
Contributor Author

@mxnet-label-bot add [Operator, Bug]

@sandeep-krishnamurthy
Copy link
Contributor

Bilinear upsampling required kernel to be passed as input because it use deconvolution under the hood. Clarified the expectation in API documentation.

 >>> x = nd.ones((1,1,3,3))
  >>> x
  [[[[1. 1. 1.]
     [1. 1. 1.]
     [1. 1. 1.]]]]
  <NDArray 1x1x3x3 @cpu(0)>
  >>> w = nd.ones((1,1,4,4))
  >>> w
  [[[[1. 1. 1. 1.]
     [1. 1. 1. 1.]
     [1. 1. 1. 1.]
     [1. 1. 1. 1.]]]]
  <NDArray 1x1x4x4 @cpu(0)>
  >>> nd.UpSampling(x, w, scale=2, sample_type='bilinear', num_filter=1)
  [[[[1. 2. 2. 2. 2. 1.]
     [2. 4. 4. 4. 4. 2.]
     [2. 4. 4. 4. 4. 2.]
     [2. 4. 4. 4. 4. 2.]
     [2. 4. 4. 4. 4. 2.]
     [1. 2. 2. 2. 2. 1.]]]]
  <NDArray 1x1x6x6 @cpu(0)>

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

Successfully merging a pull request may close this issue.

3 participants