Compute Library
AsymmHelpers.cpp File Reference
#include "arm_compute/core/utils/quantization/AsymmHelpers.h"
#include "arm_compute/core/Helpers.h"
#include "support/ToolchainSupport.h"
#include <cmath>
#include <limits>
#include <numeric>

Go to the source code of this file.


 Copyright (c) 2017-2021 Arm Limited.


Status calculate_quantized_multiplier (float multiplier, int32_t *quant_multiplier, int32_t *shift, bool ignore_epsilon=false)
 Calculate quantized representation of multiplier. More...
Status calculate_quantized_multiplier_less_than_one (float multiplier, int32_t *quant_multiplier, int32_t *right_shift, bool ignore_epsilon=false)
 Calculate quantized representation of multiplier with value less than one. More...
Status calculate_quantized_multiplier_greater_than_one (float multiplier, int32_t *quantized_multiplier, int32_t *left_shift)
 Calculate quantized representation of multiplier having value greater than one. More...
Status calculate_quantized_multipliers (const QuantizationInfo &iq_info, const QuantizationInfo &wq_info, const QuantizationInfo &oq_info, GEMMLowpOutputStageInfo &stage_info)
 Calculate quantized representation of per-channel multipliers. More...
std::pair< int, int > get_min_max_values_from_quantized_data_type (DataType data_type)
 Get minimum and maximum values for the input quantized data type. More...
void compute_quantized_multipliers_and_shifts (const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *output, unsigned int idx_ofms, int32_t *output_multipliers_ptr, int32_t *output_shifts_ptr)
 Compute quantized per-channel multipliers and shifts. More...
int32_t saturating_rounding_doubling_highmul (int32_t a, int32_t b)
 Compute multiplication of two integers. More...
int32_t rounding_divide_by_pow2 (int32_t x, int exponent)
 Round to the nearest division by a power-of-two using exponent, copied from NEMath. More...
int32_t multiply_by_quantized_multiplier (int32_t input, int32_t qmul, int32_t shift)
 Compute the value multiplied by given quantized multiplier and shift. More...
int32_t saturating_rounding_multiply_by_pow2 (int32_t exponent, int32_t v)
 Compute the value multiplied the power-of-two. More...
void get_invsqrt_quantized_multiplier_exp (int32_t input, int32_t reverse_shift, int32_t &output_inv_sqrt, int32_t &output_shift)
 Compute quantized multiplier and shift for the inverse square root of input. More...


constexpr int64_t fixed_point_one_Q0 = (1LL << 31)
constexpr float epsilon = 0.00001f