| AIfES 2 2.0.0

aifes_math.h
Go to the documentation of this file.
1
25 #ifndef AIFES_MATH
26 #define AIFES_MATH
27
28 #include <stdint.h>
29 #include <math.h>
30 #include <stdio.h>
31 #include <stdlib.h>
32
33 #include "aifes_config.h"
34
35
36 typedef struct aimath_dtype aimath_dtype_t;
37
38 typedef struct aitensor aitensor_t;
39
44 struct aimath_dtype {
45 const char *name;
46 uint32_t size;
47 uint32_t tensor_params_size;
55 void (*print_aitensor)(const aitensor_t *tensor);
56
64 void (*print_aiscalar)(const void *scalar);
65 };
66
89 struct aitensor {
90 const aimath_dtype_t *dtype;
91 uint8_t dim;
92 uint16_t *shape;
93 void *tensor_params;
94 void *data;
95 };
96
97
98 #endif // AIFES_MATH
aimath_dtype
Indicator for the used datatype.
Definition: aifes_math.h:44
aimath_dtype::tensor_params_size
uint32_t tensor_params_size
Size of the tensor params (for example for quantization parameters) of this type in bytes.
Definition: aifes_math.h:47
aimath_dtype::print_aiscalar
void(* print_aiscalar)(const void *scalar)
Set a function to print the given scalar for debugging purposes.
Definition: aifes_math.h:64
aimath_dtype::print_aitensor
void(* print_aitensor)(const aitensor_t *tensor)
Set a function to print the given tensor for debugging purposes.
Definition: aifes_math.h:55
aimath_dtype::name
const char * name
Name of the data type (for example "F32")
Definition: aifes_math.h:45
aimath_dtype::size
uint32_t size
The size of one data value of this type in bytes.
Definition: aifes_math.h:46
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89
aitensor::shape
uint16_t * shape
An array of dim elements with the shape of the tensor for example [2, 3].
Definition: aifes_math.h:92
aitensor::data
void * data
Pointer to the actual tensor data.
Definition: aifes_math.h:94
aitensor::tensor_params
void * tensor_params
Parameters to describe some data properties (for example quantization parameters like zero_point and ...
Definition: aifes_math.h:93
aitensor::dtype
const aimath_dtype_t * dtype
The datatype of the tensor, e.g.
Definition: aifes_math.h:90
aitensor::dim
uint8_t dim
The number of dimensions.
Definition: aifes_math.h:91