@yegane
I think you set value for argument size
by mistake. Currently interpolate
function supports temporal, spatial and volumetric sampling, i.e. expected inputs are 3-D, 4-D or 5-D in shape. The input dimensions are interpreted in the form: mini-batch x channels x [optional depth] x [optional height] x width.
For your case, if you want to resize on 4D input, then interpolate
does spatial sampling and interpolates for the last 2 dimension(height * width), so the list length of argument size
must be less than 2. Can you let me know why would you like to interpolate in the second dimension(channels)? Otherwise, reshape your input first and interpolate later.
For example:
>>> input = torch.randn(1, 1, 2, 2)
>>> input
tensor([[[[-0.7523, -1.5534],
[-0.2479, 0.6668]]]])
>>> F.interpolate(input, 4, mode='bilinear')
tensor([[[[-0.7523, -0.9526, -1.3531, -1.5534],
[-0.6262, -0.7192, -0.9053, -0.9983],
[-0.3740, -0.2525, -0.0097, 0.1118],
[-0.2479, -0.0192, 0.4382, 0.6668]]]])
>>> F.interpolate(input, [4, 2], mode='bilinear')
tensor([[[[-0.7523, -1.5534],
[-0.6262, -0.9983],
[-0.3740, 0.1118],
[-0.2479, 0.6668]]]])