快捷方式

conv1d

class torch.ao.nn.quantized.functional.conv1d(input, weight, bias, stride=1, padding=0, dilation=1, groups=1, padding_mode='zeros', scale=1.0, zero_point=0, dtype=torch.quint8)[source][source]

對由多個輸入平面組成的量化一維輸入應用一維卷積。

詳見 Conv1d,瞭解其詳細資訊和輸出形狀。

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

  • weight – 形狀為 (out_channels,in_channelsgroups,iW)(\text{out\_channels} , \frac{\text{in\_channels}}{\text{groups}} , iW) 的量化過濾器

  • bias – 形狀為 (out_channels)(\text{out\_channels}) 的**非量化**偏置 Tensor。Tensor 型別必須為 torch.float

  • stride – 卷積核的步長。可以是單個數字或元組 (sW,)。預設值:1

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

  • dilation – 核心元素之間的間距。可以是單個數字或元組 (dW,)。預設值:1

  • groups – 將輸入分成組,in_channels\text{in\_channels} 必須可被組數整除。預設值:1

  • padding_mode – 使用的填充模式。目前,量化卷積僅支援“zeros”。預設值:“zeros”

  • scale – 輸出的量化比例。預設值:1.0

  • zero_point – 輸出的量化零點。預設值:0

  • dtype – 使用的量化資料型別。預設值:torch.quint8

示例

>>> from torch.ao.nn.quantized import functional as qF
>>> filters = torch.randn(33, 16, 3, dtype=torch.float)
>>> inputs = torch.randn(20, 16, 50, dtype=torch.float)
>>> bias = torch.randn(33, dtype=torch.float)
>>>
>>> scale, zero_point = 1.0, 0
>>> dtype_inputs = torch.quint8
>>> dtype_filters = torch.qint8
>>>
>>> q_filters = torch.quantize_per_tensor(filters, scale, zero_point, dtype_filters)
>>> q_inputs = torch.quantize_per_tensor(inputs, scale, zero_point, dtype_inputs)
>>> qF.conv1d(q_inputs, q_filters, bias, padding=1, scale=scale, zero_point=zero_point)

© 版權所有 PyTorch 貢獻者。

使用 Sphinx 構建,主題由 Read the Docs 提供。

文件

訪問 PyTorch 的全面開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深入教程

檢視教程

資源

查詢開發資源並獲得解答

檢視資源