How to scale a symbol


guys, is there anyone know how to resize a symbol to a specific shape (h,w)?
thank you very much


Your question is quite vague. So I’m going to make these assumptions: You have a symbol which represents an NDArray of shape (H, W) (for example a greyscale image) and you’d like to resize this array to (h, w). For this purpose, you can use BilinearSampler().


Thanks for your help.
If we want to scale an NDArray, we can do it using mx.image.imresize(),
for a symbol object, I didn’t find any easy way to do this.
BilinearSampler() can do it ,but it’s a hard way.
So, I’m looking for a simple way to make it.


imresize is not an operator on NDArray, i.e. you cannot use it as part of the computational graph (no backward()). It is meant to be used for data pre-processing.

There is also ROIPooling which can also be used for resizing images.


You are right! Computational graph needs Symbols, tensorflow and caffe both can do this through resize_bilinear().
Thank you very much.