docsapi referencedarkforest-core-optim-adamw
API Referencecrate: darkforest-coresince v0.1.0-alpha

AdamW

AdamW optimizer featuring decoupled weight decay regularization.

AdamW

darkforest-core module: optim since v0.1.0-alpha

Signature

rust
pub struct AdamW { params: Vec<Tensor>, lr: f32, betas: (f32, f32), eps: f32, weight_decay: f32, step: usize, exp_avg: Vec<Tensor>, exp_avg_sq: Vec<Tensor> }

Overview

AdamW optimizer featuring decoupled weight decay regularization.

Invariants & Design Principles

  • Invariant: Bias correction computed exactly matching PyTorch torch.optim.AdamW.
  • Invariant: Milestone 1 parity gate passed: loss diff 2.38e-7 across 200 MLP training steps.

Usage Example

rust
let mut opt = AdamW::new(model.parameters(), 0.001); opt.step();

Related Components