std :: ml::tensor_nn
Struct std::AdamState
struct AdamState {
&heap float m;
&heap float v;
unsigned long size;
float lr;
float beta1;
float beta2;
float eps;
unsigned long t;
}Per-parameter state (first/second moment buffers, same size as the parameter) plus the shared hyperparameters and step count. One AdamState per parameter tensor (W1, W2, ... each get their own) -- unlike sgd_update (a pure function of data/grad/lr with no persistent state), Adam needs m/v carried across steps.
Fields
step count, starts at 0, incremented by AdamState::step
Methods
= drop()
§
static struct AdamState new(
unsigned long size,
float lr,
float beta1,
float beta2,
float eps,
)source · definitionConvenience default (lr=0.001, beta1=0.9, beta2=0.999, eps=1e-8 — the values from the original Adam paper and every framework's default).