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 10
I am wondering how to realize it.