99 #define AITENSOR_2D_Q7(shape, params, data) {aiq7, 2, shape, params, data}
112 #define Q7_TO_FLOAT(Q, S, Z) ((float) ((int16_t)(Q) - (int16_t)(Z)) / (float) (1 << (S)))
124 #define FLOAT_TO_Q7(F, S, Z) ((int8_t) ((int16_t)((F) * (1 << (S)) + ((F) >= 0 ? 0.5f : -0.5f)) + (int16_t)(Z)))
141 #define AISCALAR_Q7(F, S, Z) {FLOAT_TO_Q7(F, S, Z), S, Z}
Basic data-type independent math operations.
void aimath_q7_quantize_tensor_from_f32(const aitensor_t *tensor_f32, aitensor_t *tensor_q7)
Converts a float f32 tensor into a quantized q7 tensor.
const aimath_dtype_t * aiq7
The Q7 data-type indicator.
void aimath_q7_print_aiscalar(const void *scalar)
Printing a Q7 scalar to console.
void aimath_q7_calc_q_params_from_f32(float min_value, float max_value, aimath_q7_params_t *q_params)
Calculates the aimath_q7_params parameters.
void aimath_q7_print_aitensor(const aitensor_t *tensor)
Printing a Q7 tensor to console.
Indicator for the used datatype.
Definition: aifes_math.h:44
Parameters used for the quantized Q7 values, used as property of a tensor.
Definition: aimath_q7.h:148
int8_t zero_point
The zero point of the quantization.
Definition: aimath_q7.h:150
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q7.h:149
Single quantized Q7 value/scalar.
Definition: aimath_q7.h:155
int8_t zero_point
The zero point of the quantization.
Definition: aimath_q7.h:158
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q7.h:157
int8_t value
Quantized value .
Definition: aimath_q7.h:156
A tensor in AIfES.
Definition: aifes_math.h:89