AIfES 2  2.0.0
aifes_math.h
Go to the documentation of this file.
1 
28 #ifndef AIFES_MATH
29 #define AIFES_MATH
30 
31 #include <stdint.h>
32 #include <math.h>
33 #include <stdio.h>
34 #include <stdlib.h>
35 
36 
37 #define SHAPE_CHECK
38 #define DEBUG_CHECKS
39 #define AIDEBUG_PRINT_MODULE_SPECS
40 #define AIDEBUG_PRINT_ERROR_MESSAGES
43 #define LOG_E(M) printf(M)
44 
45 typedef struct aimath_dtype aimath_dtype_t;
46 
47 typedef struct aitensor aitensor_t;
48 
53 struct aimath_dtype {
54  const char *name;
55  uint32_t size;
56  uint32_t tensor_params_size;
64  void (*print_aitensor)(const aitensor_t *tensor);
65 
73  void (*print_aiscalar)(const void *scalar, int (*print)(const char *format, ...));
74 };
75 
98 struct aitensor {
100  uint8_t dim;
101  uint16_t *shape;
103  void *data;
104 };
105 
106 
107 #endif // AIFES_MATH
Indicator for the used datatype.
Definition: aifes_math.h:53
uint32_t tensor_params_size
Size of the tensor params (for example for quantization parameters) of this type in bytes.
Definition: aifes_math.h:56
void(* print_aiscalar)(const void *scalar, int(*print)(const char *format,...))
Set a function to print the given scalar for debugging purposes.
Definition: aifes_math.h:73
void(* print_aitensor)(const aitensor_t *tensor)
Set a function to print the given tensor for debugging purposes.
Definition: aifes_math.h:64
const char * name
Name of the data type (for example "F32")
Definition: aifes_math.h:54
uint32_t size
The size of one data value of this type in bytes.
Definition: aifes_math.h:55
A tensor in AIfES.
Definition: aifes_math.h:98
uint16_t * shape
An array of dim elements with the shape of the tensor for example [2, 3].
Definition: aifes_math.h:101
void * data
Pointer to the actual tensor data.
Definition: aifes_math.h:103
void * tensor_params
Parameters to describe some data properties (for example quantization parameters like zero_point and ...
Definition: aifes_math.h:102
const aimath_dtype_t * dtype
The datatype of the tensor, e.g.
Definition: aifes_math.h:99
uint8_t dim
The number of dimensions.
Definition: aifes_math.h:100