259 #ifdef AIDEBUG_PRINT_MODULE_SPECS
aiopti_t * aiopti_sgd(aiopti_sgd_t *opti)
Initialize the given SGD optimizer.
void aiopti_sgd_init_optimem_with_momentum(aiopti_t *self, const aitensor_t *params, const aitensor_t *gradients, void *optimem)
Initialization of the optimization memory buffer when the momentum is not zero.
uint32_t aiopti_sgd_sizeof_optimem_without_momentum(aiopti_t *self, const aitensor_t *params)
Calculates the required memory for the optimization step when the momentum is zero.
uint32_t aiopti_sgd_sizeof_optimem_with_momentum(aiopti_t *self, const aitensor_t *params)
Calculates the required memory for the optimization step when the momentum is not zero.
void aiopti_sgd_print_specs(const aiopti_t *self)
Print the optimizer specification.
void aiopti_sgd_zero_gradients(aiopti_t *self, aitensor_t *gradients)
Set the gradients to zero.
const aicore_optitype_t * aiopti_sgd_type
SGD optimizer type.
void aiopti_sgd_update_params_with_momentum(aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem)
Update the given parameter tensor with respect to the gradients when the momentum is not zero.
void aiopti_sgd_init_optimem_without_momentum(aiopti_t *self, const aitensor_t *params, const aitensor_t *gradients, void *optimem)
Initialization of the optimization memory buffer when the momentum is zero.
void aiopti_sgd_update_params_without_momentum(aiopti_t *self, aitensor_t *params, const aitensor_t *gradients, void *optimem)
Update the given parameter tensor with respect to the gradients when the momentum is zero.
Type indicator of the optimizer to check for the optimizer type.
Definition: aifes_core.h:160
General Stochastic Gradient Descent (SGD) optimizer struct.
Definition: aiopti_sgd.h:56
void(* scalar_mul)(const void *scalar, const aitensor_t *a, aitensor_t *result)
Required math function: Multiplication of a scalar with a tensor.
Definition: aiopti_sgd.h:98
void * momentum
aiscalar: Momentum(set to null to save optimization memory)
Definition: aiopti_sgd.h:65
void(* tensor_sub)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Required math function: Element wise tensor subtraction.
Definition: aiopti_sgd.h:80
void(* tensor_add)(const aitensor_t *a, const aitensor_t *b, aitensor_t *result)
Required math function: Element wise tensor addition.
Definition: aiopti_sgd.h:89
aiopti_t base
Inherited field members from general optimizer struct.
Definition: aiopti_sgd.h:57
void(* zero_tensor)(aitensor_t *tensor)
Required math function: Sets the elements of a tensor to zero.
Definition: aiopti_sgd.h:107
AIfES optimizer interface.
Definition: aifes_core.h:438
A tensor in AIfES.
Definition: aifes_math.h:89