| AIfES 2 2.0.0

aifes_express_f32_fnn.h
Go to the documentation of this file.
1
26 #ifndef EXPRESS_FNN_F32
27 #define EXPRESS_FNN_F32
28
29 #include "core/aifes_math.h"
30
33 typedef enum
34 {
35 AIfES_E_relu,
36 AIfES_E_sigmoid,
37 AIfES_E_softmax,
38 AIfES_E_leaky_relu,
39 AIfES_E_elu,
40 AIfES_E_tanh,
41 AIfES_E_softsign,
42 AIfES_E_linear
44 }AIFES_E_activations;
45
48 typedef enum
49 {
50 AIfES_E_mse,
51 AIfES_E_crossentropy
53 }AIFES_E_loss;
54
57 typedef enum
58 {
59 AIfES_E_adam,
60 AIfES_E_sgd
62 }AIFES_E_optimizer;
63
66 typedef enum
67 {
68 AIfES_E_init_uniform,
69 AIfES_E_init_glorot_uniform,
70 AIfES_E_init_no_init
72 }AIFES_E_init_weights_method;
73
76 typedef enum
77 {
78 AIfES_E_early_stopping_off,
79 AIfES_E_early_stopping_on
80
81 }AIFES_E_early_stopping;
82
107 struct AIFES_E_model_parameter_fnn_f32{
108 uint32_t layer_count;
109 uint32_t *fnn_structure;
110 AIFES_E_activations *fnn_activations;
111 void * flat_weights;
112 };
113
138 struct AIFES_E_training_parameter_fnn_f32{
139 AIFES_E_loss loss;
140 AIFES_E_optimizer optimizer;
141 float learn_rate;
142 float sgd_momentum;
143 uint32_t batch_size;
144 uint32_t epochs;
145 uint32_t epochs_loss_print_interval;
161 void (*loss_print_function)(float);
162 AIFES_E_early_stopping early_stopping;
163 float early_stopping_target_loss;
164 };
165
184 struct AIFES_E_init_weights_parameter_fnn_f32{
185 AIFES_E_init_weights_method init_weights_method;
186 float min_init_uniform;
187 float max_init_uniform;
188 };
189
190 typedef struct AIFES_E_model_parameter_fnn_f32 AIFES_E_model_parameter_fnn_f32;
191
192 typedef struct AIFES_E_training_parameter_fnn_f32 AIFES_E_training_parameter_fnn_f32;
193
194 typedef struct AIFES_E_init_weights_parameter_fnn_f32 AIFES_E_init_weights_parameter_fnn_f32;
195
196
204 uint32_t AIFES_E_flat_weights_number_fnn_f32(uint32_t *fnn_structure,uint32_t layer_count);
205
206
207
263 int8_t AIFES_E_inference_fnn_f32(aitensor_t *input_tensor,
264 AIFES_E_model_parameter_fnn_f32 *AIFES_E_fnn,
265 aitensor_t *output_tensor);
266
267
365 int8_t AIFES_E_training_fnn_f32(aitensor_t *input_tensor,
366 aitensor_t *target_tensor,
367 AIFES_E_model_parameter_fnn_f32 *AIFES_E_fnn,
368 AIFES_E_training_parameter_fnn_f32 *AIFES_E_fnn_training,
369 AIFES_E_init_weights_parameter_fnn_f32 *AIFES_E_fnn_init_weights,
370 aitensor_t *output_tensor);
371
372
373
374 #endif // EXPRESS_FNN_F32
AIFES_E_init_weights_method
AIFES_E_init_weights_method
Possible weight initialization methods in AIfES-Express.
Definition: aifes_express_f32_fnn.h:67
AIfES_E_init_no_init
@ AIfES_E_init_no_init
No weight init.
Definition: aifes_express_f32_fnn.h:70
AIfES_E_init_uniform
@ AIfES_E_init_uniform
Dices the weights in a range of values you specify.
Definition: aifes_express_f32_fnn.h:68
AIfES_E_init_glorot_uniform
@ AIfES_E_init_glorot_uniform
Random numbers are uniformly diced within a certain range.
Definition: aifes_express_f32_fnn.h:69
AIFES_E_early_stopping
AIFES_E_early_stopping
Turn early stopping on or off.
Definition: aifes_express_f32_fnn.h:77
AIFES_E_inference_fnn_f32
int8_t AIFES_E_inference_fnn_f32(aitensor_t *input_tensor, AIFES_E_model_parameter_fnn_f32 *AIFES_E_fnn, aitensor_t *output_tensor)
Executes the inference.
AIFES_E_training_fnn_f32
int8_t AIFES_E_training_fnn_f32(aitensor_t *input_tensor, aitensor_t *target_tensor, AIFES_E_model_parameter_fnn_f32 *AIFES_E_fnn, AIFES_E_training_parameter_fnn_f32 *AIFES_E_fnn_training, AIFES_E_init_weights_parameter_fnn_f32 *AIFES_E_fnn_init_weights, aitensor_t *output_tensor)
Executes the training.
AIFES_E_activations
AIFES_E_activations
Possible activation functions in AIfES-Express.
Definition: aifes_express_f32_fnn.h:34
AIfES_E_softmax
@ AIfES_E_softmax
Softmax.
Definition: aifes_express_f32_fnn.h:37
AIfES_E_leaky_relu
@ AIfES_E_leaky_relu
Leaky_relu.
Definition: aifes_express_f32_fnn.h:38
AIfES_E_sigmoid
@ AIfES_E_sigmoid
Sigmoid.
Definition: aifes_express_f32_fnn.h:36
AIfES_E_tanh
@ AIfES_E_tanh
Tanh.
Definition: aifes_express_f32_fnn.h:40
AIfES_E_relu
@ AIfES_E_relu
Relu.
Definition: aifes_express_f32_fnn.h:35
AIfES_E_elu
@ AIfES_E_elu
Elu.
Definition: aifes_express_f32_fnn.h:39
AIfES_E_softsign
@ AIfES_E_softsign
Softsign.
Definition: aifes_express_f32_fnn.h:41
AIfES_E_linear
@ AIfES_E_linear
Linear.
Definition: aifes_express_f32_fnn.h:42
AIFES_E_flat_weights_number_fnn_f32
uint32_t AIFES_E_flat_weights_number_fnn_f32(uint32_t *fnn_structure, uint32_t layer_count)
Calculates the total required float weights for the selected network structure.
AIFES_E_loss
AIFES_E_loss
Possible loss functions in AIfES-Express.
Definition: aifes_express_f32_fnn.h:49
AIfES_E_crossentropy
@ AIfES_E_crossentropy
Crossentropy.
Definition: aifes_express_f32_fnn.h:51
AIfES_E_mse
@ AIfES_E_mse
Mean squared error (MSE)
Definition: aifes_express_f32_fnn.h:50
AIFES_E_optimizer
AIFES_E_optimizer
Possible optimizers in AIfES-Express.
Definition: aifes_express_f32_fnn.h:58
AIfES_E_adam
@ AIfES_E_adam
ADAM.
Definition: aifes_express_f32_fnn.h:59
AIfES_E_sgd
@ AIfES_E_sgd
SGD.
Definition: aifes_express_f32_fnn.h:60
aifes_math.h
AIfES 2 math interface.
AIFES_E_init_weights_parameter_fnn_f32
Parameters for weight initialization.
Definition: aifes_express_f32_fnn.h:184
AIFES_E_init_weights_parameter_fnn_f32::max_init_uniform
float max_init_uniform
max value only for(AIfES_E_init_uniform)
Definition: aifes_express_f32_fnn.h:187
AIFES_E_init_weights_parameter_fnn_f32::init_weights_method
AIFES_E_init_weights_method init_weights_method
Weight initialization method (AIFES_E_init_weights_method)
Definition: aifes_express_f32_fnn.h:185
AIFES_E_init_weights_parameter_fnn_f32::min_init_uniform
float min_init_uniform
min value only for(AIfES_E_init_uniform)
Definition: aifes_express_f32_fnn.h:186
AIFES_E_model_parameter_fnn_f32
Parameters for the FNN model.
Definition: aifes_express_f32_fnn.h:107
AIFES_E_model_parameter_fnn_f32::flat_weights
void * flat_weights
Pointer to the array with the weights.
Definition: aifes_express_f32_fnn.h:111
AIFES_E_model_parameter_fnn_f32::layer_count
uint32_t layer_count
Count of all layers, including input and output layers.
Definition: aifes_express_f32_fnn.h:108
AIFES_E_model_parameter_fnn_f32::fnn_structure
uint32_t * fnn_structure
Pointer to the network structure.
Definition: aifes_express_f32_fnn.h:109
AIFES_E_model_parameter_fnn_f32::fnn_activations
AIFES_E_activations * fnn_activations
Pointer to the activation function list (AIFES_E_activations)
Definition: aifes_express_f32_fnn.h:110
AIFES_E_training_parameter_fnn_f32
Parameters for Training.
Definition: aifes_express_f32_fnn.h:138
AIFES_E_training_parameter_fnn_f32::learn_rate
float learn_rate
Learning rate for training (For all optimizers)
Definition: aifes_express_f32_fnn.h:141
AIFES_E_training_parameter_fnn_f32::early_stopping
AIFES_E_early_stopping early_stopping
Switch early stopping on or off.
Definition: aifes_express_f32_fnn.h:162
AIFES_E_training_parameter_fnn_f32::sgd_momentum
float sgd_momentum
Optional momentum for SGD (Value 0.0f means Momentum off)
Definition: aifes_express_f32_fnn.h:142
AIFES_E_training_parameter_fnn_f32::loss_print_function
void(* loss_print_function)(float)
Individual print function for the loss.
Definition: aifes_express_f32_fnn.h:161
AIFES_E_training_parameter_fnn_f32::batch_size
uint32_t batch_size
Batch size (min: 1 -> max: Entire data set)
Definition: aifes_express_f32_fnn.h:143
AIFES_E_training_parameter_fnn_f32::early_stopping_target_loss
float early_stopping_target_loss
If early stopping is switched on, the target loss can be specified here.
Definition: aifes_express_f32_fnn.h:163
AIFES_E_training_parameter_fnn_f32::optimizer
AIFES_E_optimizer optimizer
Optimizer selection (AIFES_E_optimizer)
Definition: aifes_express_f32_fnn.h:140
AIFES_E_training_parameter_fnn_f32::epochs_loss_print_interval
uint32_t epochs_loss_print_interval
Selection of the interval in which the loss is to be calculated and output via the print function.
Definition: aifes_express_f32_fnn.h:145
AIFES_E_training_parameter_fnn_f32::loss
AIFES_E_loss loss
Loss selection (AIFES_E_loss)
Definition: aifes_express_f32_fnn.h:139
AIFES_E_training_parameter_fnn_f32::epochs
uint32_t epochs
Number of desired epochs (If early stopping is on, can be stopped before)
Definition: aifes_express_f32_fnn.h:144
aitensor
A tensor in AIfES.
Definition: aifes_math.h:89