conv3d#
- class 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)[原始碼]#
在由多個輸入平面組成的量化 3D 輸入上應用 3D 卷積。
有關詳細資訊和輸出形狀,請參閱
Conv3d。- 引數
input – 形狀為 的量化輸入張量。
weight – 形狀為 的量化濾波器。
bias – 形狀為 的 **非量化** 偏置張量。張量型別必須是 torch.float。
stride – 卷積核的步長。可以是單個數字或一個元組 (sD, sH, sW)。預設為:1
padding – 輸入兩側的隱式填充。可以是單個數字或一個元組 (padD, padH, padW)。預設為:0
dilation – 核心元素之間的間距。可以是單個數字或一個元組 (dD, dH, dW)。預設為:1
groups – 將輸入分割成組, 必須能被組數整除。預設值: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)