pub struct ParameterManager<A: Float, D: Dimension> { /* private fields */ }
Expand description
Neural network parameter manager with lazy registration
Implementations§
Source§impl<A: Float + ScalarOperand + Debug, D: Dimension> ParameterManager<A, D>
impl<A: Float + ScalarOperand + Debug, D: Dimension> ParameterManager<A, D>
Sourcepub fn new(config: OptimizationConfig<A>) -> Self
pub fn new(config: OptimizationConfig<A>) -> Self
Create a new parameter manager
Sourcepub fn enable_lazy_mode(&mut self)
pub fn enable_lazy_mode(&mut self)
Enable lazy registration mode
Sourcepub fn disable_lazy_mode(&mut self) -> Result<()>
pub fn disable_lazy_mode(&mut self) -> Result<()>
Disable lazy registration mode and process pending registrations
Sourcepub fn register_layer(
&mut self,
layer_id: LayerId,
architecture: LayerArchitecture,
)
pub fn register_layer( &mut self, layer_id: LayerId, architecture: LayerArchitecture, )
Register a layer architecture
Sourcepub fn set_layer_rule(
&mut self,
layer_id: LayerId,
rule: LayerOptimizationRule<A>,
)
pub fn set_layer_rule( &mut self, layer_id: LayerId, rule: LayerOptimizationRule<A>, )
Set layer-specific optimization rule
Sourcepub fn register_parameter(
&mut self,
param_id: ParamId,
metadata: ParameterMetadata,
) -> Result<()>
pub fn register_parameter( &mut self, param_id: ParamId, metadata: ParameterMetadata, ) -> Result<()>
Register a parameter
Sourcepub fn get_effective_learning_rate(&self, param_id: &ParamId) -> A
pub fn get_effective_learning_rate(&self, param_id: &ParamId) -> A
Get effective learning rate for a parameter
Sourcepub fn get_effective_weight_decay(&self, param_id: &ParamId) -> A
pub fn get_effective_weight_decay(&self, param_id: &ParamId) -> A
Get effective weight decay for a parameter
Sourcepub fn is_parameter_frozen(&self, param_id: &ParamId) -> bool
pub fn is_parameter_frozen(&self, param_id: &ParamId) -> bool
Check if parameter is frozen
Sourcepub fn get_sharing_group(&self, group_name: &str) -> Option<&[ParamId]>
pub fn get_sharing_group(&self, group_name: &str) -> Option<&[ParamId]>
Get parameters in a sharing group
Sourcepub fn get_all_parameters(&self) -> &HashMap<ParamId, ParameterMetadata>
pub fn get_all_parameters(&self) -> &HashMap<ParamId, ParameterMetadata>
Get all registered parameters
Sourcepub fn get_layer_architecture(
&self,
layer_id: &LayerId,
) -> Option<&LayerArchitecture>
pub fn get_layer_architecture( &self, layer_id: &LayerId, ) -> Option<&LayerArchitecture>
Get layer architecture
Sourcepub fn get_parameter_metadata(
&self,
param_id: &ParamId,
) -> Option<&ParameterMetadata>
pub fn get_parameter_metadata( &self, param_id: &ParamId, ) -> Option<&ParameterMetadata>
Get parameter metadata
Sourcepub fn update_config(&mut self, config: OptimizationConfig<A>)
pub fn update_config(&mut self, config: OptimizationConfig<A>)
Update global configuration
Sourcepub fn get_optimizer_state(
&self,
param_id: &ParamId,
) -> Option<&HashMap<String, Array<A, D>>>
pub fn get_optimizer_state( &self, param_id: &ParamId, ) -> Option<&HashMap<String, Array<A, D>>>
Get optimizer state for parameter
Sourcepub fn get_optimizer_state_mut(
&mut self,
param_id: &ParamId,
) -> Option<&mut HashMap<String, Array<A, D>>>
pub fn get_optimizer_state_mut( &mut self, param_id: &ParamId, ) -> Option<&mut HashMap<String, Array<A, D>>>
Get mutable optimizer state for parameter
Sourcepub fn init_optimizer_state(
&mut self,
param_id: &ParamId,
state_name: &str,
state: Array<A, D>,
) -> Result<()>
pub fn init_optimizer_state( &mut self, param_id: &ParamId, state_name: &str, state: Array<A, D>, ) -> Result<()>
Initialize optimizer state for parameter
Sourcepub fn reset_optimizer_states(&mut self)
pub fn reset_optimizer_states(&mut self)
Reset all optimizer states
Sourcepub fn get_parameters_by_layer(&self, layer_id: &LayerId) -> Vec<&ParamId> ⓘ
pub fn get_parameters_by_layer(&self, layer_id: &LayerId) -> Vec<&ParamId> ⓘ
Get parameters by layer
Sourcepub fn get_parameters_by_type(&self, param_type: ParameterType) -> Vec<&ParamId> ⓘ
pub fn get_parameters_by_type(&self, param_type: ParameterType) -> Vec<&ParamId> ⓘ
Get parameters by type
Sourcepub fn get_trainable_parameters(&self) -> Vec<&ParamId> ⓘ
pub fn get_trainable_parameters(&self) -> Vec<&ParamId> ⓘ
Get trainable parameters
Trait Implementations§
Auto Trait Implementations§
impl<A, D> Freeze for ParameterManager<A, D>where
A: Freeze,
impl<A, D> RefUnwindSafe for ParameterManager<A, D>where
A: RefUnwindSafe,
D: RefUnwindSafe,
impl<A, D> Send for ParameterManager<A, D>where
A: Send,
impl<A, D> Sync for ParameterManager<A, D>where
A: Sync,
impl<A, D> Unpin for ParameterManager<A, D>
impl<A, D> UnwindSafe for ParameterManager<A, D>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more