tensor.qlinear_conv
Performs convolution on quantized Tensors
The convolution operator consumes a quantized input tensor, its scale and zero point, a quantized filter, its scale and zero point, and output's scale and zero point, and computes the quantized output. Each scale and zero-point pair must have same shape. It means they must be either scalars (per tensor) or 1-D tensors (per output channel). Each input or output and its related zero point must have same type.
Args
X
(@Tensor<i8>
) - Quantized input data tensor, has size (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn).X_scale
(@Tensor<T>
) - Scale for inputX
.X_zero_point
(@Tensor<T>
) - Zero point for inputX
.W
(@Tensor<i8>
) - Quantized weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel.W_scale
(@Tensor<T>
) - Scale for inputW
.W_zero_point
(@Tensor<T>
) - Zero point for inputW
.B
(Option<@Tensor<T>>
) - Optional 1D bias to be added to the convolution, has size of M. Bias must be quantized using scale = x_scale * w_scale and zero_point = 0.auto_pad
(Option<AUTO_PAD>
) - Default is NOTSET, auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. NOTSET means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so thatoutput_shape[i] = ceil(input_shape[i] / strides[i])
for each axisi
.dilations
(Option<Span<usize>>
) - Dilation value along each spatial axis of the filter. If not present, the dilation defaults to 1 along each spatial axis.group
(Option<usize>
) - Default is 1, number of groups input channels and output channels are divided into.kernel_shape
(Option<Span<usize>>
) - The shape of the convolution kernel. If not present, should be inferred from input W.pads
(Option<Span<usize>>
) - Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis.pads
format should be as follow [x1_begin, x2_begin...x1_end, x2_end,...], where xi_begin the number of pixels added at the beginning of axisi
and xi_end, the number of pixels added at the end of axisi
. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis.strides
(Option<Span<usize>>
) - Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis.y_scale
(@Tensor<T>
) - Scale for output.y_zero_point
(@Tensor<T>
) - Zero point for output.
Returns
A new Tensor<i8>
, containing the quantized result of the convolution of the dequantized inputs.
Type Constraints
u32 tensor, not supported. fp8x23wide tensor, not supported. fp16x16wide tensor, not supported.
Example
Last updated