pub struct BaseOptimizerPlugin<A: Float + Debug> { /* private fields */ }Expand description
Base optimizer plugin implementation with common functionality
Implementations§
Source§impl<A: Float + Debug + Send + Sync + 'static> BaseOptimizerPlugin<A>
impl<A: Float + Debug + Send + Sync + 'static> BaseOptimizerPlugin<A>
Sourcepub fn new(info: PluginInfo, capabilities: PluginCapabilities) -> Self
pub fn new(info: PluginInfo, capabilities: PluginCapabilities) -> Self
Create a new base optimizer plugin
Sourcepub fn add_event_handler(&mut self, handler: Box<dyn PluginEventHandler>)
pub fn add_event_handler(&mut self, handler: Box<dyn PluginEventHandler>)
Add event handler
Sourcepub fn update_metrics(&mut self, steptime: Duration)
pub fn update_metrics(&mut self, steptime: Duration)
Update performance metrics
Trait Implementations§
Source§impl<A: Float + Debug + Send + Sync + 'static> OptimizerPlugin<A> for BaseOptimizerPlugin<A>
impl<A: Float + Debug + Send + Sync + 'static> OptimizerPlugin<A> for BaseOptimizerPlugin<A>
Source§fn step(
&mut self,
params: &Array1<A>,
gradients: &Array1<A>,
) -> Result<Array1<A>>
fn step( &mut self, params: &Array1<A>, gradients: &Array1<A>, ) -> Result<Array1<A>>
SGD with momentum, weight decay, and L2 gradient-norm clipping,
driven entirely by self.config (OptimizerConfig). This is the
SDK’s documented base class for plugin authors: it must itself be a
working, registrable optimizer – not merely a field-storage struct
– since BaseOptimizerPlugin is re-exported at the crate root and
used directly wherever a caller needs a plain baseline.
Source§fn plugin_info(&self) -> PluginInfo
fn plugin_info(&self) -> PluginInfo
Get plugin information
Source§fn capabilities(&self) -> PluginCapabilities
fn capabilities(&self) -> PluginCapabilities
Get optimizer capabilities
Source§fn initialize(&mut self, paramshape: &[usize]) -> Result<()>
fn initialize(&mut self, paramshape: &[usize]) -> Result<()>
Initialize optimizer with parameters
Source§fn get_config(&self) -> OptimizerConfig
fn get_config(&self) -> OptimizerConfig
Get optimizer configuration
Source§fn set_config(&mut self, config: OptimizerConfig) -> Result<()>
fn set_config(&mut self, config: OptimizerConfig) -> Result<()>
Set optimizer configuration
Source§fn get_state(&self) -> Result<OptimizerState>
fn get_state(&self) -> Result<OptimizerState>
Get optimizer state for serialization
Source§fn set_state(&mut self, state: OptimizerState) -> Result<()>
fn set_state(&mut self, state: OptimizerState) -> Result<()>
Set optimizer state from deserialization
Source§fn clone_plugin(&self) -> Box<dyn OptimizerPlugin<A>>
fn clone_plugin(&self) -> Box<dyn OptimizerPlugin<A>>
Clone the optimizer plugin
Source§fn memory_usage(&self) -> MemoryUsage
fn memory_usage(&self) -> MemoryUsage
Get memory usage information
Source§fn performance_metrics(&self) -> PerformanceMetrics
fn performance_metrics(&self) -> PerformanceMetrics
Get performance metrics
Auto Trait Implementations§
impl<A> !RefUnwindSafe for BaseOptimizerPlugin<A>
impl<A> !UnwindSafe for BaseOptimizerPlugin<A>
impl<A> Freeze for BaseOptimizerPlugin<A>
impl<A> Send for BaseOptimizerPlugin<A>where
A: Send,
impl<A> Sync for BaseOptimizerPlugin<A>where
A: Sync,
impl<A> Unpin for BaseOptimizerPlugin<A>where
A: Unpin,
impl<A> UnsafeUnpin for BaseOptimizerPlugin<A>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.