|
25.11
|
#include <armnn/Exceptions.hpp>Go to the source code of this file.
Functions | |
| void | CreateRawRescaleTosaOperator (const std::string &inputName, const std::string &outputName, const std::vector< int32_t > &multipliers, const std::vector< int32_t > &shifts, int32_t input_zp, int32_t output_zp, bool input_unsigned, bool output_unsigned, bool double_round, bool scale32, bool per_channel, TosaSerializationOperator **op) |
| Creates a raw rescale TOSA operator. | |
| void | ComputeMultiplierAndShiftTosaScale32 (double scale, int32_t &multiplier, int32_t &shift) |
| The following is taken from mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp in the LLVM project From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 32-bit scaling. | |
| void | ComputeMultiplierAndShiftTosaScale16 (double scale, int32_t &multiplier, int32_t &shift) |
| The following is taken from mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp in the LLVM project From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 16-bit scaling. | |
| void | CreateRescaleTosaOperator (const std::string &inputName, const std::string &outputName, double scale, int32_t input_zp, int32_t output_zp, bool input_unsigned, bool output_unsigned, bool double_round, bool scale32, TosaSerializationOperator **op) |
| Creates a Tosa rescale operator. | |
| void | CreateRescaleTosaOperatorForWeights (const std::string &inputName, const std::string &outputName, int32_t input_zp, int32_t output_zp, bool input_unsigned, bool output_unsigned, bool double_round, bool scale32, double input_scale, double output_scale, const std::vector< float > &weight_scales, TosaSerializationOperator **op) |
| Creates a TOSA rescale operator for weight tensors. | |
|
inline |
The following is taken from mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp in the LLVM project From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 16-bit scaling.
Definition at line 137 of file TosaRescaleOperatorUtils.hpp.
Referenced by CreateRescaleTosaOperator(), and CreateRescaleTosaOperatorForWeights().
|
inline |
The following is taken from mlir/lib/Dialect/Tosa/Utils/QuantUtils.cpp in the LLVM project From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 32-bit scaling.
Definition at line 94 of file TosaRescaleOperatorUtils.hpp.
Referenced by ConvertReduceToTosaOperator(), CreateRescaleTosaOperator(), and CreateRescaleTosaOperatorForWeights().
|
inline |
Creates a raw rescale TOSA operator.
This inline function creates a raw rescale operator for TOSA that adjusts the quantization parameters for an input tensor. It validates the multipliers and shifts vectors, ensuring they meet specific criteria for per-channel or global quantization. If any validation fails, an exception is thrown.
| inputName | : The name of the input tensor. |
| outputName | : The name of the output tensor. |
| multipliers | : A vector of multiplier values for scaling. |
| shifts | : A vector of shift values corresponding to the multipliers. |
| input_zp | : The zero point for the input tensor. |
| output_zp | : The zero point for the output tensor. |
| input_unsigned | : Indicates if the input tensor is unsigned. |
| output_unsigned | : Indicates if the output tensor is unsigned. |
| double_round | : If true, applies double rounding during quantization. |
| scale32 | : If true, performs 32-bit scaling; otherwise, 16-bit scaling is used. |
| per_channel | : Determines whether per-channel quantization is applied. |
| op | : Pointer to store the created TosaSerializationOperator. |
Definition at line 32 of file TosaRescaleOperatorUtils.hpp.
Referenced by ConvertReduceToTosaOperator(), CreateRescaleTosaOperator(), and CreateRescaleTosaOperatorForWeights().
|
inline |
Creates a Tosa rescale operator.
This inline function computes the multiplier and shift values based on the given scale using either 32-bit or 16-bit scaling. It then creates a raw rescale operator that adjusts the quantization parameters for the input tensor.
| inputName | : The name of the input tensor. |
| outputName | : The name of the output tensor. |
| scale | : The scale factor used to compute the multiplier and shift. |
| input_zp | : The zero point for the input tensor. |
| output_zp | : The zero point for the output tensor. |
| input_unsigned | : Indicates if the input tensor is unsigned. |
| output_unsigned | Indicates if the output tensor is unsigned. |
| double_round | : If true, uses double rounding for quantization. |
| scale32 | : If true, performs 32-bit scaling; otherwise, 16-bit scaling is used. |
| op | : Pointer to a variable that will store the created TosaSerializationOperator. |
Definition at line 197 of file TosaRescaleOperatorUtils.hpp.
References ComputeMultiplierAndShiftTosaScale16(), ComputeMultiplierAndShiftTosaScale32(), and CreateRawRescaleTosaOperator().
Referenced by ConvertElementwiseBinaryToTosaOperator(), ConvertLeakyReluToTosaOperator(), ConvertPReluToTosaOperator(), ConvertQuantizeToTosaOperator(), ConvertReduceToTosaOperator(), ConvertReluToTosaOperator(), ConvertResizeToTosaOperator(), ConvertSoftmaxToTosaOperator(), and ConvertSquaredDifferenceToTosaOperator().
|
inline |
Creates a TOSA rescale operator for weight tensors.
This function computes multipliers and shift values for each weight scale by combining the input scale, weight scale, and output scale. It determines the quantization parameters using either 32-bit or 16-bit calculations based on the scale32 flag. The per_channel flag is set true if the provided weight scales are more than one. An exception is thrown if any computation fails.
| inputName | : The name of the input tensor. |
| outputName | : The name of the output tensor. |
| input_zp | : The zero point for the input tensor. |
| output_zp | : The zero point for the output tensor. |
| input_unsigned | : Indicates if the input tensor is unsigned. |
| output_unsigned | : Indicates if the output tensor is unsigned. |
| double_round | : If true, uses double rounding for quantization. |
| scale32 | : If true, uses 32-bit scaling; otherwise, uses 16-bit scaling. |
| input_scale | : The scaling factor for the input tensor. |
| output_scale | : The scaling factor for the output tensor. |
| weight_scales | : Vector of weight scales for per-channel quantization. |
| op | : Pointer to store the created TosaSerializationOperator. |
Definition at line 258 of file TosaRescaleOperatorUtils.hpp.
References ComputeMultiplierAndShiftTosaScale16(), ComputeMultiplierAndShiftTosaScale32(), and CreateRawRescaleTosaOperator().
Referenced by ConvertBatchMatMulToTosaOperator(), ConvertConv2dToTosaOperator(), ConvertConv3dToTosaOperator(), ConvertDepthwiseConv2dToTosaOperator(), and ConvertFullyConnectedToTosaOperator().