Perform quantized dot of quantized Tensor lhs
and quantized Tensor rhs
to make quantized output
.
tf.raw_ops.UniformQuantizedDot(
lhs,
rhs,
lhs_scales,
lhs_zero_points,
rhs_scales,
rhs_zero_points,
output_scales,
output_zero_points,
Tout,
lhs_quantization_min_val,
lhs_quantization_max_val,
rhs_quantization_min_val,
rhs_quantization_max_val,
output_quantization_min_val,
output_quantization_max_val,
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 2D Tensors and the lhs.dim_size(1) must match rhs.dim_size(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
|
A Tensor . Must be one of the following types: qint8 .
Must be a 2D Tensor of Tin.
|
rhs
|
A Tensor . Must have the same type as lhs .
Must be a 2D Tensor of Tin.
|
lhs_scales
|
A Tensor of type float32 .
The float value(s) used as scale when quantizing original data that lhs represents.
Must be a scalar Tensor (lhs supports only per-tensor quantization).
|
lhs_zero_points
|
A Tensor of type int32 .
The int32 value(s) used as zero_point when quantizing original data that lhs represents.
Same shape condition as lhs_scales.
|
rhs_scales
|
A Tensor of type float32 .
The float value(s) used as scale when quantizing original data that rhs represents.
Must be a scalar Tensor (per-tensor quantization) or 1D Tensor of size (rhs.dim_size(1),) (per-channel quantization).
|
rhs_zero_points
|
A Tensor of type int32 .
The int32 value(s) used as zero_point when quantizing original data that rhs represents.
Same shape condition as rhs_scales.
|
output_scales
|
A Tensor of type float32 .
The float value(s) to use as scales when quantizing original data that output represents.
Must be a scalar Tensor (per-tensor quantization) or 1D Tensor of size (output.dim_size(1),) (per-channel quantization).
If rhs is per-tensor quantized, output must be also per-tensor quantized.
This means that if rhs_scales and rhs_zero_points are scalar Tensors, output_scales and output_zero_points must be scalar Tensors as well.
|
output_zero_points
|
A Tensor of type int32 .
The int32 value(s) used as zero_point when quantizing original data that output represents.
Same shape condition as rhs_scales.
|
Tout
|
A tf.DType from: tf.qint32 . The type of output Tensor.
|
lhs_quantization_min_val
|
An int .
The min value of the quantized data stored in lhs.
For example, if Tin is qint8, this must be set to -127 if narrow range quantized or -128 if not.
|
lhs_quantization_max_val
|
An int .
The max value of the quantized data stored in rhs.
For example, if Tin is qint8, this must be set to 127.
|
rhs_quantization_min_val
|
An int .
The min value of the quantized data stored in rhs.
For example, if Trhs is qint8, this must be set to -127 if narrow range quantized or -128 if not.
|
rhs_quantization_max_val
|
An int .
The max value of the quantized data stored in rhs.
For example, if Trhs is qint8, this must be set to 127.
|
output_quantization_min_val
|
An int .
The min value of the quantized data stored in output.
For example, if Tout is qint8, this must be set to -127 if narrow range quantized or -128 if not.
|
output_quantization_max_val
|
An int .
The max value of the quantized data stored in output.
For example, if Tout is qint8, this must be set to 127.
|
lhs_quantization_axis
|
An optional 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 dot op lhs, only per-tensor quantization is supported.
Thus, this attribute must be set to -1. Other values are rejected.
|
rhs_quantization_axis
|
An optional 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 dot op rhs, only per-tensor quantization or per-channel quantization along dimension 1 is supported.
Thus, this attribute must be set to -1 or 1. Other values are rejected.
|
output_quantization_axis
|
An optional 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 dot op output, only per-tensor quantization or per-channel quantization along dimension 1 is supported.
Thus, this attribute must be set to -1 or 1. Other values are rejected.
|
name
|
A name for the operation (optional). |
Returns | |
---|---|
A Tensor of type Tout .
|