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

Problem with mx.symbol.UpSampling #4891

@back2yes

Description

@back2yes

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions