Perform quantized dot of quantized Tensor `lhs` and quantized Tensor `rhs` to make quantized `output`.
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.
Nested Classes
class | UniformQuantizedDot.Options | Optional attributes for UniformQuantizedDot
|
Public Methods
Output<U> |
asOutput()
Returns the symbolic handle of a tensor.
|
static <U, T> UniformQuantizedDot<U> |
create(Scope scope, Operand<T> lhs, Operand<T> rhs, Operand<Float> lhsScales, Operand<Integer> lhsZeroPoints, Operand<Float> rhsScales, Operand<Integer> rhsZeroPoints, Operand<Float> outputScales, Operand<Integer> outputZeroPoints, Class<U> Tout, Long lhsQuantizationMinVal, Long lhsQuantizationMaxVal, Long rhsQuantizationMinVal, Long rhsQuantizationMaxVal, Long outputQuantizationMinVal, Long outputQuantizationMaxVal, Options... options)
Factory method to create a class wrapping a new UniformQuantizedDot operation.
|
static UniformQuantizedDot.Options |
lhsQuantizationAxis(Long lhsQuantizationAxis)
|
Output<U> |
output()
The output 2D Tensor of Tout, whose shape is (lhs.dim_size(0), rhs.dim_size(1)).
|
static UniformQuantizedDot.Options |
outputQuantizationAxis(Long outputQuantizationAxis)
|
static UniformQuantizedDot.Options |
rhsQuantizationAxis(Long rhsQuantizationAxis)
|
Inherited Methods
Public Methods
public Output<U> asOutput ()
Returns the symbolic handle of a tensor.
Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.
public static UniformQuantizedDot<U> create (Scope scope, Operand<T> lhs, Operand<T> rhs, Operand<Float> lhsScales, Operand<Integer> lhsZeroPoints, Operand<Float> rhsScales, Operand<Integer> rhsZeroPoints, Operand<Float> outputScales, Operand<Integer> outputZeroPoints, Class<U> Tout, Long lhsQuantizationMinVal, Long lhsQuantizationMaxVal, Long rhsQuantizationMinVal, Long rhsQuantizationMaxVal, Long outputQuantizationMinVal, Long outputQuantizationMaxVal, Options... options)
Factory method to create a class wrapping a new UniformQuantizedDot operation.
Parameters
scope | current scope |
---|---|
lhs | Must be a 2D Tensor of Tin. |
rhs | Must be a 2D Tensor of Tin. |
lhsScales | 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). |
lhsZeroPoints | The int32 value(s) used as zero_point when quantizing original data that lhs represents. Same shape condition as lhs_scales. |
rhsScales | 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). |
rhsZeroPoints | The int32 value(s) used as zero_point when quantizing original data that rhs represents. Same shape condition as rhs_scales. |
outputScales | 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. |
outputZeroPoints | The int32 value(s) used as zero_point when quantizing original data that output represents. Same shape condition as rhs_scales. |
Tout | The type of output Tensor. |
lhsQuantizationMinVal | 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. |
lhsQuantizationMaxVal | The max value of the quantized data stored in rhs. For example, if Tin is qint8, this must be set to 127. |
rhsQuantizationMinVal | 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. |
rhsQuantizationMaxVal | The max value of the quantized data stored in rhs. For example, if Trhs is qint8, this must be set to 127. |
outputQuantizationMinVal | 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. |
outputQuantizationMaxVal | The max value of the quantized data stored in output. For example, if Tout is qint8, this must be set to 127. |
options | carries optional attributes values |
Returns
- a new instance of UniformQuantizedDot
public static UniformQuantizedDot.Options lhsQuantizationAxis (Long lhsQuantizationAxis)
Parameters
lhsQuantizationAxis | 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. |
---|
public Output<U> output ()
The output 2D Tensor of Tout, whose shape is (lhs.dim_size(0), rhs.dim_size(1)).
public static UniformQuantizedDot.Options outputQuantizationAxis (Long outputQuantizationAxis)
Parameters
outputQuantizationAxis | 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. |
---|
public static UniformQuantizedDot.Options rhsQuantizationAxis (Long rhsQuantizationAxis)
Parameters
rhsQuantizationAxis | 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. |
---|