最近用到了上采样下采样操作,pytorch中使用interpolate可以很轻松的完成
def interpolate(input, size=None, scale_factor=None, mode...当前支持 temporal, spatial 和 volumetric 输入数据的上采样,其shape 分别为:3-D, 4-D 和 5-D....)
print(y1.shape)
print(y2.shape)
这里注意上采样的时候mode默认是“nearest”,这里指定双线性插值“bilinear”
得到结果
torch.Size([1,..._normalize_sequence(zoom, input.ndim)
output_shape = tuple(
[int(round(ii * jj)) for ii, jj in zip(input.shape...(filtered, zoom, None, output, order, mode, cval)
return output
中的zoom函数进行插值,
但是,如果此时的数据是tensor(张量)的时候