AdamW class

Implements the AdamW optimization algorithm with decoupled weight decay. Modifies the standard Adam update by applying weight decay directly to the parameters rather than incorporating it into the gradient moments.

Inheritance

Constructors

AdamW(List<Tensor> parameters, {required double learningRate, double beta1 = 0.9, double beta2 = 0.999, double epsilon = 1e-8, double weightDecay = 0.01})
Creates an AdamW optimizer for parameters with learningRate, decay rates beta1 and beta2, epsilon, and decoupled weightDecay.

Properties

beta1 ↔ double
Exponential decay rate for the first moment estimates.
getter/setter pair
beta2 ↔ double
Exponential decay rate for the second moment estimates.
getter/setter pair
epsilon ↔ double
Small constant added to the denominator to prevent division by zero.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
learningRate ↔ double
The step size factor applied during parameter updates.
getter/setter pairinherited
parameters ↔ List<Tensor>
The collection of trainable parameter tensors managed by this optimizer.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
weightDecay ↔ double
Weight decay coefficient applied independently of gradient moment updates.
getter/setter pair

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
step() → void
Performs a single optimization step, updating moment estimates, applying decoupled weight decay directly to parameter values, and adjusting parameters.
override
toString() → String
A string representation of this object.
inherited
zeroGrad() → void
Clears gradients by resetting the gradient buffer of every managed tensor in parameters to 0.0.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited