3D卷积

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

对该三维输入进行三维卷积操作,该输入由多个输入平面组成并已量化。

详细信息和输出形状请参见Conv3d

参数
  • input - 量化输入张量,其形状为$(\text{minibatch} , \text{in\_channels} , iD , iH , iW)$

  • weight – 量化滤波器,其形状为 $(\text{out\_channels} , \frac{\text{in\_channels}}{\text{groups}} , kD , kH , kW)$

  • bias非量化偏置张量,形状为$(\text{out\_channels})$。其类型必须是torch.float

  • stride — 卷积核的步幅。可以是单个数值或元组 (sD, sH, sW)。默认值为 1。

  • padding – 输入两端的隐含填充量。可以是单个数值或元组形式的(padD, padH, padW)。默认值为0。

  • dilation – 卷积核元素间的距离。可以是单个数值或元组(dD, dH, dW)。默认值:1

  • groups — 将输入分为多个组,其中 $\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(8, 4, 3, 3, 3, dtype=torch.float)
>>> inputs = torch.randn(1, 4, 5, 5, 5, dtype=torch.float)
>>> bias = torch.randn(8, 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.conv3d(q_inputs, q_filters, bias, padding=1, scale=scale, zero_point=zero_point)
本页目录