102#define AITENSOR_2D_Q31(shape, params, data) {aiq31, 2, shape, params, data}
116#define Q31_TO_FLOAT(Q, S, Z) ((float) ((int64_t)(Q) - (int64_t)(Z)) / (float) ((int64_t) 1ULL << (S)))
128#define FLOAT_TO_Q31(F, S, Z) ((int32_t) ((int64_t)((F) * (1ULL << (S)) + ((F) >= 0 ? 0.5f : -0.5f)) + (int64_t)(Z)))
145#define AISCALAR_Q31(F, S, Z) {FLOAT_TO_Q31(F, S, Z), S, Z}
Basic data-type independent math operations.
void aimath_q31_calc_q_params_from_f32(float min_value, float max_value, aimath_q31_params_t *q_params)
Calculates the aimath_q31_params parameters.
void aimath_q31_print_aitensor(const aitensor_t *tensor)
Printing a Q31 tensor to console.
void aimath_q31_print_aiscalar(const void *scalar)
Printing a Q31 scalar to console.
void aimath_q31_quantize_tensor_from_f32(const aitensor_t *tensor_f32, aitensor_t *tensor_q31)
Converts a float f32 tensor into a quantized q31 tensor.
const aimath_dtype_t * aiq31
The Q31 data-type indicator.
Indicator for the used datatype.
Definition: aifes_math.h:47
Parameters used for the quantized Q31 values, used as property of a tensor.
Definition: aimath_q31.h:152
int32_t zero_point
The zero point of the quantization.
Definition: aimath_q31.h:154
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q31.h:153
Single quantized Q31 value/scalar.
Definition: aimath_q31.h:159
int32_t value
Quantized value .
Definition: aimath_q31.h:160
int32_t zero_point
The zero point of the quantization.
Definition: aimath_q31.h:162
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q31.h:161
A tensor in AIfES.
Definition: aifes_math.h:92