How do I interpolate directly on tensor?

Is there any easy way?
I want to do interpolation(BICUBIC) directly on the variable
(torch.cuda.FloatTensor of size 1x3x256x256 (GPU 0)) without other any transform

I am not sure if Bicubic interpolation is available. I can see ‘nearest’ | ‘linear’ | ‘bilinear’ | ‘trilinear’.

Wow, that’ s cool !
but, I used the 0.3.1 version, this version does not have such a function…

When I tried interpolate(x,scale_factor=3), I am getting output of shape torch.Size([3, 21, 63]) but I expected torch.Size([3, 63, 63]). What should I do. I tried to make tuple of shapes like (3,3), it didnt help as well. Kindly note that x is of shape torch.Size([3, 21, 21])

Your input tensor is treated as a temporal signal, thus only the sequence length (dim2) will be interpolated, while the batch size and channels stay the same (dim0, dim1).

If your input is an image tensor, unsqueeze the batch dimension before passing it to F.interpolate:

x = x.unsqueeze(0)
out = F.interpolate(x, scale_factor=3)