How to rescale a tensor?

In luatorch, we have an image package which is capable of rescale a tensor. See the following code:

local low_pattern = torch.Tensor(res*MAX_SIZE, res*MAX_SIZE):uniform(0,1):mul(255)
local pattern = image.scale(low_pattern, MAX_SIZE, MAX_SIZE,'bicubic')

For more code, please refer to context-encoder
I am wondering how to realize it.

Does something like this work?

Could you give more descriptions?

You can use the transform method in torchvision package.Like,