評價此頁

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 (intTuple[int] 或 Tuple[int, int] 或 Tuple[int, int, int]) – 輸出的空間大小。

  • scale_factor (floatTuple[float]) – 空間尺寸的乘數。必須是整數。

  • 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