Hi, this is how I use UpSampling - for nearest interpolation. I recall there was an issue - I had trouble when I was trying to do bilinear.
def __init__(self,_nfilters, factor = 2, _norm_type='BatchNorm', **kwards):
self.factor = factor
self.nfilters = _nfilters // self.factor
self.convup_normed = Conv2DNormed(self.nfilters,
kernel_size = (3,3), # you can choose to use (1,1), but then nearby pixels will again have same value for the same channel, for interpolation "nearest".
padding = 1,
_norm_type = _norm_type,
x = F.UpSampling(_xl, scale=self.factor, sample_type='nearest')
x = self.convup_normed(x)
in this example I first upsample, (double the size) and then I apply a convolution operator to “smooth” out the upscaling. I am using it in place of transposed convolution.
See also stackoverflow question I asked few months back.
Hope this helps.
edit There is also a new operator (at least I just saw it) in
mxnet.F.contrib.BilinearResize2D, however you need to supply the new height and width (F can be either Symbol or NDArray).