tf.raw_ops.UniformQuantizedDotHybrid
Stay organized with collections
Save and categorize content based on your preferences.
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 .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[],[],null,["# tf.raw_ops.UniformQuantizedDotHybrid\n\n\u003cbr /\u003e\n\nPerform hybrid quantized dot of float Tensor `lhs` and quantized Tensor `rhs`.\n\n#### View aliases\n\n\n**Compat aliases for migration**\n\nSee\n[Migration guide](https://www.tensorflow.org/guide/migrate) for\nmore details.\n\n[`tf.compat.v1.raw_ops.UniformQuantizedDotHybrid`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/UniformQuantizedDotHybrid)\n\n\u003cbr /\u003e\n\n tf.raw_ops.UniformQuantizedDotHybrid(\n lhs,\n rhs,\n rhs_scales,\n rhs_zero_points,\n Tout,\n rhs_quantization_min_val,\n rhs_quantization_max_val,\n rhs_quantization_axis=-1,\n name=None\n )\n\nGiven float `lhs` and quantized `rhs`, internally performs quantization on `lhs`, and then performs quantized dot on quantized lhs and `rhs`.\nThe 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\\]).\n`lhs` and `rhs` must be 2D Tensors and the lhs.dim_size(1) must match rhs.dim_size(0).\n`rhs` must be quantized Tensor, where its data value is quantized using the formula:\nquantized_data = clip(original_data / scale + zero_point, quantization_min_val, quantization_max_val).\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `lhs` | A `Tensor`. Must be one of the following types: `float32`. Must be a 2D Tensor of Tlhs. |\n| `rhs` | A `Tensor`. Must be one of the following types: `qint8`. Must be a 2D Tensor of Trhs. |\n| `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). |\n| `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. |\n| `Tout` | A [`tf.DType`](../../tf/dtypes/DType) from: [`tf.float32`](../../tf#float32). The type of output Tensor. |\n| `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. |\n| `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. |\n| `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. |\n| `name` | A name for the operation (optional). |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| A `Tensor` of type `Tout`. ||\n\n\u003cbr /\u003e"]]