my input size is 128x5x5, after maxpooling the size is 128x2x2. i want use the upsample to make the 128x2x2 to 128x5x5. how to change the code
x2 = F.interpolate(x1, size=[5,5])
my input size is 128x5x5, after maxpooling the size is 128x2x2. i want use the upsample to make the 128x2x2 to 128x5x5. how to change the code
x2 = F.interpolate(x1, size=[5,5])
Hi,
Try the following code snippet.
import torch.nn as nn
import torch
x = torch.randn((128, 2, 2))
x = x.unsqueeze(dim=0)
ups = nn.Upsample(size=[5, 5])
out = ups(x).squeeze(0)
print(out.shape)
There are various modes of upsampling. Please check the doc here - https://pytorch.org/docs/master/generated/torch.nn.Upsample.html
Thanks
Regards
Pranavan
i will try. thank you so much