AIfES 2  2.0.0
aiopti Struct Reference

AIfES optimizer interface. More...

#include <aifes_core.h>

Data Fields

const aicore_optitype_toptimizer_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_tdtype
 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...
 

Detailed Description

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:

allocate memory of size sizeof_optimem()
for batch in dataset
for each trainable parameter tensor in the model
endfor
forward_model(batch)
backward_model(batch)
for each trainable parameter tensor in the model
endfor
endfor
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.
Definition: aifes_core.h:459
void(* begin_step)(aiopti_t *self)
Called in the beginning of every model optimization step for parameter initialization.
Definition: aifes_core.h:472
void(* update_params)(aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem)
Performs an optimization step on the given tensor.
Definition: aifes_core.h:481
uint32_t(* sizeof_optimem)(aiopti_t *self, const aitensor_t *params)
Calculates the optimization memory size for a trainable parameter tensor.
Definition: aifes_core.h:450
void(* zero_gradients)(aiopti_t *self, aitensor_t *gradients)
Set the gradient tensor to zero.
Definition: aifes_core.h:466
void(* end_step)(aiopti_t *self)
Called in the end of every model optimization step.
Definition: aifes_core.h:487

Field Documentation

◆ begin_step

void(* begin_step) (aiopti_t *self)

Called in the beginning of every model optimization step for parameter initialization.

Parameters
selfThe layer

◆ end_step

void(* end_step) (aiopti_t *self)

Called in the end of every model optimization step.

Parameters
selfThe layer

◆ init_optimem

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.

Parameters
selfThe layer
paramsThe trainable parameter tensor
gradientsThe associated gradients tensor
optimemThe associated optimization memory to initialize

◆ learning_rate

void* learning_rate

The learning rate configures the training speed.

The learning rate is an aiscalar_t value of given dtype.

◆ sizeof_optimem

uint32_t(* sizeof_optimem) (aiopti_t *self, const aitensor_t *params)

Calculates the optimization memory size for a trainable parameter tensor.

Parameters
selfThe layer
paramsThe trainable parameter tensor

◆ update_params

void(* update_params) (aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem)

Performs an optimization step on the given tensor.

Parameters
selfThe layer
paramsThe trainable parameter tensor
gradientsThe associated gradients tensor
optimemThe associated optimization memory to initialize

◆ zero_gradients

void(* zero_gradients) (aiopti_t *self, aitensor_t *gradients)

Set the gradient tensor to zero.

Parameters
selfThe layer
paramsThe gradient tensor

The documentation for this struct was generated from the following file: