upsample#
- class torch.ao.nn.quantized.functional.upsample(input, size=None, scale_factor=None, mode='nearest', align_corners=None)[source]#
将输入上采样到指定的大小
size
或指定的scale_factor
。警告
此函数已弃用,推荐使用
torch.ao.nn.quantized.functional.interpolate()
。这等同于nn.quantized.functional.interpolate(...)
。有关实现细节,请参阅
torch.nn.functional.interpolate()
。The input dimensions are interpreted in the form: mini-batch x channels x [optional depth] x [optional height] x width.
注意
输入量化参数会传播到输出。
注意
对于量化输入,仅支持 2D 输入。
注意
对于量化输入,仅支持以下模式:
bilinear
nearest
- 参数
input (Tensor) – 量化输入张量。
size (int 或 Tuple[int] 或 Tuple[int, int] 或 Tuple[int, int, int]) – 输出的空间大小。
mode (str) – 用于上采样的算法:
'nearest'
|'bilinear'
align_corners (bool, optional) – 在几何上,我们将输入和输出的像素视为正方形而不是点。如果设置为
True
,输入和输出张量将通过其角落像素的中心点对齐,从而保留角落像素的值。如果设置为False
,输入和输出张量将通过其角落像素的角落点对齐,并且插值使用边缘值填充来处理边界外的值,使得该操作与输入大小无关(当scale_factor
保持不变时)。这仅在mode
为'bilinear'
时才有效。默认为False
。
警告
当
align_corners = True
时,线性插值模式(bilinear)不会按比例对齐输出和输入像素,因此输出值可能取决于输入大小。这是 0.3.1 版本之前这些模式的默认行为。此后,默认行为为align_corners = False
。有关此如何影响输出的具体示例,请参阅Upsample
。