| AIfES 2 2.0.0

aiopti_sgd_default.h
Go to the documentation of this file.
1
27 #ifndef AIOPTI_SGD_DEFAULT
28 #define AIOPTI_SGD_DEFAULT
29
30 #include "basic/base/aiopti/aiopti_sgd.h"
31
32 #include "basic/default/aimath/aimath_f32_default.h"
33 #include "basic/default/aimath/aimath_q31_default.h"
34 #include "basic/default/aimath/aimath_q7_default.h"
35
36 #define AIOPTI_SGD_F32(learning_rate) {{{0,},},learning_rate, 0.0f}
37 #define AIOPTI_SGD_WITH_MOMENTUM_F32(learning_rate, momentum) {{{0,},},learning_rate, momentum}
38 #define AIOPTI_SGD_Q31(learning_rate) {{{0,},},learning_rate, {0,0,0}}
39 #define AIOPTI_SGD_WITH_MOMENTUM_Q31(learning_rate, momentum) {{{0,},},learning_rate, momentum}
40
41 typedef struct aiopti_sgd_f32 aiopti_sgd_f32_t;
42 typedef struct aiopti_sgd_q31 aiopti_sgd_q31_t;
43 typedef struct aiopti_sgd_q7 aiopti_sgd_q7_t;
49 struct aiopti_sgd_f32 {
50 aiopti_sgd_t base;
52 aiscalar_f32_t learning_rate;
54 aiscalar_f32_t momentum;
55 };
56
61 struct aiopti_sgd_q31 {
62 aiopti_sgd_t base;
64 aiscalar_q31_t learning_rate;
66 aiscalar_q31_t momentum;
67 };
68
111 aiopti_t *aiopti_sgd_f32_default(aiopti_sgd_f32_t *opti);
112
155 aiopti_t *aiopti_sgd_q31_default(aiopti_sgd_q31_t *opti);
156
157 #endif // AIOPTI_SGD_DEFAULT
aiscalar_f32_t
float aiscalar_f32_t
Scalar for F32 (aif32) data-type.
Definition: aimath_f32.h:120
aimath_f32_default.h
Math functions for F32 data type, default implementation.
aimath_q31_default.h
Math functions for Q31 data type, default implementation.
aimath_q7_default.h
Math functions for Q7 data type, default implementation.
aiopti_sgd.h
Base optimizer implementation of the Stochastic Gradient Descent (with momentum) optimizer.
aiopti_sgd_f32_default
aiopti_t * aiopti_sgd_f32_default(aiopti_sgd_f32_t *opti)
Initializes a SGD optimizer with the F32 default implementation.
aiopti_sgd_q31_default
aiopti_t * aiopti_sgd_q31_default(aiopti_sgd_q31_t *opti)
Initializes a SGD optimizer with the Q31 default implementation.
aiopti_sgd_q7_t
struct aiopti_sgd_q7 aiopti_sgd_q7_t
New data type name for code reduction.
Definition: aiopti_sgd_default.h:43
aiopti_sgd_f32
Data-type specific SGD optimizer struct for F32 .
Definition: aiopti_sgd_default.h:49
aiopti_sgd_f32::base
aiopti_sgd_t base
Inherited field members from general aiopti_sgd struct.
Definition: aiopti_sgd_default.h:50
aiopti_sgd_f32::learning_rate
aiscalar_f32_t learning_rate
Storage for aiopti.learning_rate scalar in F32.
Definition: aiopti_sgd_default.h:52
aiopti_sgd_f32::momentum
aiscalar_f32_t momentum
Storage for aiopti_sgd.momentum scalar in F32.
Definition: aiopti_sgd_default.h:54
aiopti_sgd_q31
Data-type specific SGD optimizer struct for Q31 .
Definition: aiopti_sgd_default.h:61
aiopti_sgd_q31::base
aiopti_sgd_t base
Inherited field members from general optimizer struct.
Definition: aiopti_sgd_default.h:62
aiopti_sgd_q31::momentum
aiscalar_q31_t momentum
Data-type specific momentum.
Definition: aiopti_sgd_default.h:66
aiopti_sgd_q31::learning_rate
aiscalar_q31_t learning_rate
Data-type specific learning rate.
Definition: aiopti_sgd_default.h:64
aiopti_sgd
General Stochastic Gradient Descent (SGD) optimizer struct.
Definition: aiopti_sgd.h:56
aiopti
AIfES optimizer interface.
Definition: aifes_core.h:438
aiscalar_q31
Single quantized Q31 value/scalar.
Definition: aimath_q31.h:156