F.interpolate插值大小设定

import torch

import torch.nn.functional as F
h, w = 180, 320
img = torch.FloatTensor(1,3, h, w)
zoom=2
hr1 = F.interpolate(img, scale_factor=zoom, mode='bicubic')

hr2 = F.interpolate(img, (int(img.size()[2]*zoom),int(img.size()[3]*zoom)), mode='bicubic')

print(hr1.shape,hr2.shape)

输出 torch.Size([1, 3, 360, 640]) torch.Size([1, 3, 360, 640])
 

你可能感兴趣的:(Pytorch,深度学习,python,人工智能)