import torch
import torch.nn as nn
a = torch.arange(1,5,dtype=torch.float32).view(1,1,2,2)
print(a)
b = nn.Upsample(scale_factor=2,mode="nearest")#缩放因子
print(b(a))#临近上采样
c = nn.Upsample(scale_factor=2, mode='bilinear')
print(c(a))#双线插值
d = nn.Upsample(scale_factor=2,mode="bilinear",align_corners=True)#角落对齐
print(d(a))
上采样
最新推荐文章于 2023-10-17 22:41:00 发布