102#define AITENSOR_2D_Q7(shape, params, data) {aiq7, 2, shape, params, data}
115#define Q7_TO_FLOAT(Q, S, Z) ((float) ((int16_t)(Q) - (int16_t)(Z)) / (float) (1 << (S)))
127#define FLOAT_TO_Q7(F, S, Z) ((int8_t) ((int16_t)((F) * (1 << (S)) + ((F) >= 0 ? 0.5f : -0.5f)) + (int16_t)(Z)))
144#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:47
Parameters used for the quantized Q7 values, used as property of a tensor.
Definition: aimath_q7.h:151
int8_t zero_point
The zero point of the quantization.
Definition: aimath_q7.h:153
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q7.h:152
Single quantized Q7 value/scalar.
Definition: aimath_q7.h:158
int8_t zero_point
The zero point of the quantization.
Definition: aimath_q7.h:161
uint16_t shift
The scaling factor of the quantization (The total scale is calculated with )
Definition: aimath_q7.h:160
int8_t value
Quantized value .
Definition: aimath_q7.h:159
A tensor in AIfES.
Definition: aifes_math.h:92