Perform hybrid quantized dot of float Tensor lhs
and quantized Tensor rhs
.
tf.raw_ops.UniformQuantizedDotHybrid(
lhs,
rhs,
rhs_scales,
rhs_zero_points,
Tout,
rhs_quantization_min_val,
rhs_quantization_max_val,
rhs_quantization_axis=-1,
name=None
)
Given float lhs
and quantized rhs
, internally performs quantization on lhs
, and then performs quantized dot on quantized lhs and rhs
.
The internal quantization on lhs
is a quantization to qint8, dynamic range, per-batch (per-axis along axis 0), asymmetric, and not narrow range (the range is [-128, 127]).
lhs
and rhs
must be 2D Tensors and the lhs.dim_size(1) must match rhs.dim_size(0).
rhs
must be quantized Tensor, where its data value is quantized using the formula:
quantized_data = clip(original_data / scale + zero_point, quantization_min_val, quantization_max_val).
Args | |
---|---|
lhs
|
A Tensor . Must be one of the following types: float32 .
Must be a 2D Tensor of Tlhs.
|
rhs
|
A Tensor . Must be one of the following types: qint8 .
Must be a 2D Tensor of Trhs.
|
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.
|
Tout
|
A tf.DType from: tf.float32 . The type of output Tensor.
|
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.
|
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.
|
name
|
A name for the operation (optional). |
Returns | |
---|---|
A Tensor of type Tout .
|