AIfES 2  2.0.0
aialgo_sequential_training.h
Go to the documentation of this file.
1 
24 #ifndef AIALGO_SEQUENTIAL_TRAINING
25 #define AIALGO_SEQUENTIAL_TRAINING
26 
27 #include "core/aifes_core.h"
28 #include "core/aifes_math.h"
31 
42 uint32_t aialgo_sizeof_training_memory(aimodel_t *model, aiopti_t *optimizer);
43 
56 uint8_t aialgo_schedule_training_memory(aimodel_t *model, aiopti_t *optimizer, void *memory_ptr, uint32_t memory_size);
57 
64 
70 void aialgo_backward_model(aimodel_t *model, aitensor_t *target_data);
71 
105 uint8_t aialgo_train_model(aimodel_t *model, aitensor_t *input_tensor, aitensor_t *target_tensor, aiopti_t *optimizer, uint32_t batch_size);
106 
114 uint8_t aialgo_calc_loss_model_f32(aimodel_t *model, aitensor_t *input_data, aitensor_t *target_data, float *result);
115 
123 uint8_t aialgo_calc_loss_model_q31(aimodel_t *model, aitensor_t *input_data, aitensor_t *target_data, aiscalar_q31_t *result);
124 
131 
138 
146 
154 
163 
164 #endif // AIALGO_SEQUENTIAL_TRAINING
void aialgo_zero_gradients_model(aimodel_t *model, aiopti_t *optimizer)
Set the gradients to zero.
void aialgo_update_params_model(aimodel_t *model, aiopti_t *optimizer)
Perform the optimization step on the model parameters.
void aialgo_init_model_for_training(aimodel_t *model, aiopti_t *optimizer)
Initialize the optimization memory of the model layers.
uint8_t aialgo_train_model(aimodel_t *model, aitensor_t *input_tensor, aitensor_t *target_tensor, aiopti_t *optimizer, uint32_t batch_size)
Perform one training epoch on all data batches of the dataset using backpropagation.
uint8_t aialgo_calc_loss_model_q31(aimodel_t *model, aitensor_t *input_data, aitensor_t *target_data, aiscalar_q31_t *result)
Calculate the loss in Q31 data type.
void aialgo_print_optimizer_specs(aiopti_t *opti)
Print the optimizer specs.
uint8_t aialgo_schedule_training_memory(aimodel_t *model, aiopti_t *optimizer, void *memory_ptr, uint32_t memory_size)
Assign the memory for model training.
uint32_t aialgo_sizeof_training_memory(aimodel_t *model, aiopti_t *optimizer)
Calculate the memory requirements for model training.
uint8_t aialgo_calc_loss_model_f32(aimodel_t *model, aitensor_t *input_data, aitensor_t *target_data, float *result)
Calculate the loss in F32 data type.
void aialgo_print_loss_specs(ailoss_t *loss)
Print the loss specs.
void aialgo_initialize_parameters_model(aimodel_t *model)
Initialize the parameters of the given model with their default initialization method.
void aialgo_backward_model(aimodel_t *model, aitensor_t *target_data)
Perform the backward pass.
AIfES 2 core interface.
AIfES 2 math interface.
Basic data-type independent math operations.
Definition of the Q31 (aiq31) data-type.
AIfES loss interface.
Definition: aifes_core.h:385
AIfES artificial neural network model.
Definition: aifes_core.h:181
AIfES optimizer interface.
Definition: aifes_core.h:438
Single quantized Q31 value/scalar.
Definition: aimath_q31.h:156
A tensor in AIfES.
Definition: aifes_math.h:89