mode='linear' is for data with only one spatial dimension. Image data has 2 spatial dim.
for image like data, you should use mode='bilinear'.
The following code will work for 1d data. 100 is #numchannel for 1d input.
x = torch.rand(1,100,100)
F.interpolate(x, size=(64), mode="linear")

or for 2d,
x = torch.rand(1,1,100,100)
F.interpolate(x, size=(64,64), mode="bilinear")