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

Problem with mx.symbol.UpSampling #4891

Closed
back2yes opened this issue Feb 5, 2017 · 2 comments
Closed

Problem with mx.symbol.UpSampling #4891

back2yes opened this issue Feb 5, 2017 · 2 comments

Comments

@back2yes
Copy link

back2yes commented Feb 5, 2017

The document of mx.symbol.UpSampling was ambiguous. With several attempts, I found that the following code would produce a result successfully by chance. By the way, I realized that the weights for bilinear up-sampling needs to be defined explicitly, however this was not mentioned in the document.

The codes:

import mxnet as mx
import numpy as np

a = mx.sym.Variable('a')
a_nd = mx.nd.ones((10, 5, 8, 8), ctx=mx.gpu())
w = mx.sym.Variable('w')
w_np = np.zeros((5, 1, 4, 4))
w_np[:, :, [0, -1, 0, -1], [0, -1, -1, 0]] = 1.0
w_nd = mx.nd.array(w_np, ctx=mx.gpu())

b = mx.sym.UpSampling(a, w, num_args=2, scale=2, sample_type='bilinear', num_filter=5)

exe1 = b.bind(ctx=mx.gpu(), args={'a':a_nd, 'w':w_nd})
exe1.forward()
print exe1.outputs[0].asnumpy().shape
print exe1.outputs[0].asnumpy()

Sometimes this raises an error:

src/operator/./deconvolution-inl.h:75: Check failed: pad_y >= target_shape[0] (18 vs. 1537294416) too big target shape

The number in bold varies! Here goes error information in other attempts:

  • pad_y >= target_shape[0] (18 vs. 31615648)
  • pad_y >= target_shape[0] (18 vs. 528347216)
  • pad_y >= target_shape[0] (18 vs. 40733264)

Sometimes the program produce a result:

(10, 5, 16, 16)
[[[[ 0.  0.  0. ...,  0.  0.  0.]
   [ 0.  1.  1. ...,  1.  1.  0.]
   [ 0.  1.  1. ...,  1.  1.  0.]
   ..., 
   ..., 
   [ 0.  1.  1. ...,  1.  1.  0.]
   [ 0.  1.  1. ...,  1.  1.  0.]
   [ 0.  0.  0. ...,  0.  0.  0.]]]]

Is this a bug?

@howard0su
Copy link
Contributor

try #4923

@back2yes
Copy link
Author

@howard0su

It works, thanks a lot!!!

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

No branches or pull requests

2 participants