nn.conv_integer
Performs integer convolution
The integer convolution operator consumes an input tensor, its zero-point, a filter, and its zero-point, and computes the output.
Args
X
(@Tensor<i8>
) - 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)..W
(@Tensor<i8>
) - 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.X_zero_point
(@Tensor<T>
) - Zero point for inputX
W_zero_point
(@Tensor<T>
) - Zero point for inputW
.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.
Returns
A new Tensor<usize>
, containing the result of the convolution of the inputs.
Example
Last updated