Skip to main content

Checkpointable

Trait Checkpointable 

Source
pub trait Checkpointable<A: Float + ToString + Display + FromStr, D: Dimension> {
    // Required methods
    fn create_checkpoint(&self) -> Result<OptimizerCheckpoint<A, D>>;
    fn restore_checkpoint(
        &mut self,
        checkpoint: &OptimizerCheckpoint<A, D>,
    ) -> Result<()>;

    // Provided methods
    fn save_checkpoint<P: AsRef<Path>>(&self, path: P) -> Result<()> { ... }
    fn load_checkpoint<P: AsRef<Path>>(&mut self, path: P) -> Result<()> { ... }
}
Expand description

Trait for optimizers that support checkpointing

Required Methods§

Source

fn create_checkpoint(&self) -> Result<OptimizerCheckpoint<A, D>>

Create a checkpoint of the current optimizer state

Source

fn restore_checkpoint( &mut self, checkpoint: &OptimizerCheckpoint<A, D>, ) -> Result<()>

Restore optimizer state from a checkpoint

Provided Methods§

Source

fn save_checkpoint<P: AsRef<Path>>(&self, path: P) -> Result<()>

Save checkpoint to file (simple text format)

Source

fn load_checkpoint<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Load checkpoint from file (simple text format)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§