Perform quantized convolution of quantized Tensor lhs and quantized Tensor rhs. to make quantized output.
tf.raw_ops.UniformQuantizedConvolution(
lhs,
rhs,
lhs_scales,
lhs_zero_points,
rhs_scales,
rhs_zero_points,
output_scales,
output_zero_points,
Tout,
padding,
lhs_quantization_min_val,
lhs_quantization_max_val,
rhs_quantization_min_val,
rhs_quantization_max_val,
output_quantization_min_val,
output_quantization_max_val,
window_strides=[],
explicit_padding=[],
lhs_dilation=[],
rhs_dilation=[],
batch_group_count=1,
feature_group_count=1,
dimension_numbers='',
lhs_quantization_axis=-1,
rhs_quantization_axis=-1,
output_quantization_axis=-1,
name=None
)
Given quantized lhs and quantized rhs, performs quantized dot on lhs and rhs to make quantized output.
lhs and rhs must be Tensors of same rank, and meet following shape conditions.
lhs_feature%feature_group_count== 0lhs_feature%rhs_input_feature== 0lhs_feature/feature_group_count==rhs_input_featurerhs_output_feature%feature_group_count== 0lhs_batch%batch_group_count== 0rhs_output_feature%batch_group_count== 0
lhs and rhs must be quantized Tensor, where data value is quantized using the formula:
quantized_data = clip(original_data / scale + zero_point, quantization_min_val, quantization_max_val)
output is also quantized, using the same formula.
If rhs is per-tensor quantized, output must be also per-tensor quantized.
Args |
|---|
lhs
Tensor. Must be one of the following types: qint8.
Must be a quantized tensor, rank >= 3.
rhs
Tensor. Must have the same type as lhs.
Must be a quantized tensor, same rank as lhs.
lhs_scales
Tensor of type float32.
The float value(s) used as scale factors when quantizing the original data that lhs represents.
Must be a scalar Tensor (lhs supports only per-tensor quantization).
lhs_zero_points
Tensor of type int32.
The int32 value(s) used as zero points when quantizing original data that lhs represents.
Same shape condition as lhs_scales.
rhs_scales
Tensor of type float32.
The float value(s) used as scale factors when quantizing the original data that rhs represents.
Must be a scalar Tensor for per-tensor quantization,
or 1D Tensor of size rhs.dim_size(kernel_output_feature_dimension), for per-channel quantization.
rhs_zero_points
Tensor of type int32.
The int32 value(s) used as zero points when quantizing original data that rhs represents.
Same shape condition as rhs_scales.
output_scales
Tensor of type float32.
The float value(s) to use as scale factors when quantizing original data that output represents.
Must be a scalar Tensor for per-tensor quantization,
or 1D Tensor of size rhs.dim_size(kernel_output_feature_dimension)- which is equal to
output.dim_size(output_feature_dimension), for per-channel quantization. Ifrhsis per-tensor quantized, output must be also per-tensor quantized. This means that ifrhs_scalesandrhs_zero_pointsare scalarTensors,output_scalesandoutput_zero_pointsmust be scalarTensors as well.output_zero_pointsA Tensorof typeint32. The int32 value(s) used as zero points when quantizing original data that output represents. Same shape condition asoutput_scales.ToutA tf.DTypefrom:tf.qint32. The type ofoutputTensor.paddingA string. string from:"SAME","VALID", or"EXPLICIT", indicating the type of padding algorithm to use.lhs_quantization_min_valAn int. The min value of the quantized data stored inlhs. For example, ifTinisqint8, this must be set to -127 if narrow range quantized or -128 if not.lhs_quantization_max_valAn int. The max value of the quantized data stored inlhs. For example, ifTinisqint8, this must be set to 127.rhs_quantization_min_valAn int. The min value of the quantized data stored inrhs. For example, ifTinisqint8, this must be set to -127 if narrow range quantized or -128 if not.rhs_quantization_max_valAn int. The max value of the quantized data stored inrhs. For example, ifTinisqint8, this must be set to 127.output_quantization_min_valAn int. The min value of the quantized data stored inoutput. For example, ifToutisqint8, this must be set to -127 if narrow range quantized or -128 if not.output_quantization_max_valAn int. The max value of the quantized data stored inoutput. For example, ifToutisqint8, this must be set to 127.window_stridesAn optional list of ints. Defaults to[]. The stride of the sliding window for each spatial dimension oflhs. Must be an empty list (default) or a list of size (number of spatial dimensions). If an empty list is provided, the stride for each spatial dimension is set to 1.explicit_paddingAn optional list of ints. Defaults to[]. Ifpaddingis"EXPLICIT", must be set as a list indicating the explicit paddings at the start and end of eachlhsspatial dimension. Otherwise, this must be empty.
(If used,) Must be a list of size 2 * (number of lhs spatial dimensions),
where (explicit_padding[2 * i], explicit_padding[2 * i + 1]) indicates
(start_padding, end_padding) of spatial_dimensions[i].
lhs_dilation
ints. Defaults to [].
The dilation factor to apply in each spatial dimension of lhs.
Must be an empty list (default) or a list of size (number of lhs spatial dimensions).
If empty list, the dilation for each lhs spatial dimension is set to 1.
rhs_dilation
ints. Defaults to [].
The dilation factor to apply in each spatial dimension of rhs.
Must be an empty list (default) or a list of size (number of rhs spatial dimensions).
If empty list, the dilation for each rhs spatial dimension is set to 1.
batch_group_count
int. Defaults to 1.
The number of batch groups. Used for grouped filters.
Must be a divisor of output_feature.
feature_group_count
int. Defaults to 1.
The number of feature groups. Used for grouped convolutions.
Must be a divisor of both lhs_feature and output_feature.
dimension_numbers
string. Defaults to "".
Structure of dimension information for the convolution op.
Must be an empty string (default) or a serialized string of tensorflow.UniformQuantizedConvolutionDimensionNumbersAttr proto.
If empty string, the default is ("NCHW", "OIHW", "NCHW") (for a 2D convolution).
lhs_quantization_axis
int. Defaults to -1.
Indicates the dimension index of the tensor where per-axis quantization is applied for the slices along that dimension.
If set to -1 (default), this indicates per-tensor quantization.
For the lhs, only per-tensor quantization is supported.
Thus, this must be set to -1.
Other values will raise error at OpKernel construction.
rhs_quantization_axis
int. Defaults to -1.
Indicates the dimension index of the tensor where per-axis quantization is applied for the slices along that dimension.
If set to -1 (default), this indicates per-tensor quantization.
For the rhs, only per-tensor quantization
or per-channel quantization along kernel_output_feature_dimension is supported.
Thus, this must be set to -1 or dimension_numbers.kernel_output_feature_dimension.
Other values will raise error at OpKernel construction.
output_quantization_axis
int. Defaults to -1.
Indicates the dimension index of the tensor where per-axis quantization is applied for the slices along that dimension.
If set to -1 (default), this indicates per-tensor quantization.
For the output, only per-tensor quantization or per-channel quantization along output_feature_dimension is supported.
Thus, this must be set to -1 or dimension_numbers.output_feature_dimension.
Other values will raise error at OpKernel construction.
name
Returns | |
|---|---|
A Tensor of type Tout.
|