快捷方式

torch.nn.functional.avg_pool1d

torch.nn.functional.avg_pool1d(input, kernel_size, stride=None, padding=0, ceil_mode=False, count_include_pad=True) Tensor

對由多個輸入平面組成的輸入訊號應用 1D 平均池化。

有關詳細資訊和輸出形狀,請參閱 AvgPool1d

參數
  • input – 形狀為 (minibatch,in_channels,iW)(\text{minibatch} , \text{in\_channels} , iW) 的輸入張量

  • kernel_size – 視窗的大小。可以是單一數字或元組 (kW,)

  • stride – 視窗的步幅。可以是單一數字或元組 (sW,)。預設值:kernel_size

  • padding – 輸入兩側的隱式零填充。可以是單一數字或元組 (padW,)。預設值:0

  • ceil_mode – 如果為 True,將使用 ceil 而不是 floor 來計算輸出形狀。預設值:False

  • count_include_pad – 如果為 True,將在平均計算中包含零填充。預設值:True

範例

>>> # pool of square window of size=3, stride=2
>>> input = torch.tensor([[[1, 2, 3, 4, 5, 6, 7]]], dtype=torch.float32)
>>> F.avg_pool1d(input, kernel_size=3, stride=2)
tensor([[[ 2.,  4.,  6.]]])

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources