AIfES 2
2.0.0
|
AIfES optimizer interface. More...
#include <aifes_core.h>
Data Fields | |
const aicore_optitype_t * | optimizer_type |
Type of the optimizer (for example aiopti_sgd_type) | |
void * | optimizer_configuration |
Optimizer specific configurations (back-link from abstract aiopti class to implementation) | |
const aimath_dtype_t * | dtype |
The data-type of the parameter that the optimizer can optimize and the learning rate. | |
void * | learning_rate |
The learning rate configures the training speed. More... | |
uint32_t(* | sizeof_optimem )(aiopti_t *self, const aitensor_t *params) |
Calculates the optimization memory size for a trainable parameter tensor. More... | |
void(* | init_optimem )(aiopti_t *self, const aitensor_t *params, const aitensor_t *gradients, void *optimem) |
Initialize the optimization memory for a trainable parameter tensor. More... | |
void(* | zero_gradients )(aiopti_t *self, aitensor_t *gradients) |
Set the gradient tensor to zero. More... | |
void(* | begin_step )(aiopti_t *self) |
Called in the beginning of every model optimization step for parameter initialization. More... | |
void(* | update_params )(aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem) |
Performs an optimization step on the given tensor. More... | |
void(* | end_step )(aiopti_t *self) |
Called in the end of every model optimization step. More... | |
AIfES optimizer interface.
The interface contains the necessary functions and parameters for parameter optimizers in backpropagation training. (Refer to aifes_core.h for a structural overview)
Optimizers are responsible for updating the trainable parameters of the model with the gradients calculated in the backward pass.
The call order of the functions is:
void(* begin_step) (aiopti_t *self) |
Called in the beginning of every model optimization step for parameter initialization.
self | The layer |
void(* end_step) (aiopti_t *self) |
Called in the end of every model optimization step.
self | The layer |
void(* init_optimem) (aiopti_t *self, const aitensor_t *params, const aitensor_t *gradients, void *optimem) |
Initialize the optimization memory for a trainable parameter tensor.
self | The layer |
params | The trainable parameter tensor |
gradients | The associated gradients tensor |
optimem | The associated optimization memory to initialize |
void* learning_rate |
The learning rate configures the training speed.
The learning rate is an aiscalar_t value of given dtype.
uint32_t(* sizeof_optimem) (aiopti_t *self, const aitensor_t *params) |
Calculates the optimization memory size for a trainable parameter tensor.
self | The layer |
params | The trainable parameter tensor |
void(* update_params) (aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem) |
Performs an optimization step on the given tensor.
self | The layer |
params | The trainable parameter tensor |
gradients | The associated gradients tensor |
optimem | The associated optimization memory to initialize |
void(* zero_gradients) (aiopti_t *self, aitensor_t *gradients) |
Set the gradient tensor to zero.
self | The layer |
params | The gradient tensor |