pub struct ParameterGroup {
pub name: String,
pub parameters: Vec<Parameter>,
pub lr_scale: f32,
pub weight_decay: Option<f32>,
pub frozen: bool,
}Expand description
A named parameter group for differential optimizer treatment.
Groups are construction-time configuration: lr_scale multiplies the
optimizer’s base learning rate for member parameters, weight_decay
replaces the optimizer-level decay when present (Some(0.0) is the decay
exclusion), and frozen parameters keep both their values and their
optimizer moments untouched across updates. The name is diagnostic; it
participates in validation errors. Group membership must be disjoint and
cover the optimizer’s whole parameter set.
Fields§
§name: StringDiagnostic group name.
parameters: Vec<Parameter>Member parameters; disjoint across groups.
lr_scale: f32Multiplier on the base learning rate.
weight_decay: Option<f32>Per-group weight decay replacing the optimizer default.
frozen: boolFrozen members skip value and moment updates entirely.
Implementations§
Source§impl ParameterGroup
impl ParameterGroup
Sourcepub fn new(name: impl Into<String>, parameters: Vec<Parameter>) -> Self
pub fn new(name: impl Into<String>, parameters: Vec<Parameter>) -> Self
Construct a group with default treatment — unit learning-rate scale, optimizer-level weight decay, unfrozen.
Sourcepub fn with_lr_scale(self, lr_scale: f32) -> Self
pub fn with_lr_scale(self, lr_scale: f32) -> Self
Multiplier on the base learning rate for member parameters.
Sourcepub fn with_weight_decay(self, weight_decay: f32) -> Self
pub fn with_weight_decay(self, weight_decay: f32) -> Self
Per-group weight decay; zero excludes members from decay.