pub struct Checkpoint {
pub metadata: CheckpointMetadata,
/* private fields */
}Expand description
A checkpoint containing executor state.
Fields§
§metadata: CheckpointMetadataCheckpoint metadata
Implementations§
Source§impl Checkpoint
impl Checkpoint
Sourcepub fn from_executor(
executor: &Scirs2Exec,
iteration: usize,
) -> TlBackendResult<Self>
pub fn from_executor( executor: &Scirs2Exec, iteration: usize, ) -> TlBackendResult<Self>
Create a checkpoint from an executor.
Sourcepub fn from_executor_with_config(
executor: &Scirs2Exec,
iteration: usize,
config: &CheckpointConfig,
) -> TlBackendResult<Self>
pub fn from_executor_with_config( executor: &Scirs2Exec, iteration: usize, config: &CheckpointConfig, ) -> TlBackendResult<Self>
Create a checkpoint with custom configuration.
Sourcepub fn load<P: AsRef<Path>>(path: P) -> TlBackendResult<Self>
pub fn load<P: AsRef<Path>>(path: P) -> TlBackendResult<Self>
Load checkpoint from a file.
Sourcepub fn load_with_config<P: AsRef<Path>>(
path: P,
config: &CheckpointConfig,
) -> TlBackendResult<Self>
pub fn load_with_config<P: AsRef<Path>>( path: P, config: &CheckpointConfig, ) -> TlBackendResult<Self>
Load checkpoint with custom configuration.
Sourcepub fn restore(&self) -> TlBackendResult<Scirs2Exec>
pub fn restore(&self) -> TlBackendResult<Scirs2Exec>
Restore an executor from this checkpoint.
Sourcepub fn restore_into(&self, executor: &mut Scirs2Exec) -> TlBackendResult<()>
pub fn restore_into(&self, executor: &mut Scirs2Exec) -> TlBackendResult<()>
Restore tensors into an existing executor.
Sourcepub fn add_metadata(&mut self, key: String, value: String)
pub fn add_metadata(&mut self, key: String, value: String)
Add custom metadata to the checkpoint.
Sourcepub fn get_metadata(&self, key: &str) -> Option<&String>
pub fn get_metadata(&self, key: &str) -> Option<&String>
Get custom metadata from the checkpoint.
Sourcepub fn size_bytes(&self) -> usize
pub fn size_bytes(&self) -> usize
Get the size of this checkpoint in bytes (uncompressed).
Sourcepub fn size_human_readable(&self) -> String
pub fn size_human_readable(&self) -> String
Get a human-readable size string.
Trait Implementations§
Source§impl Clone for Checkpoint
impl Clone for Checkpoint
Source§fn clone(&self) -> Checkpoint
fn clone(&self) -> Checkpoint
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Checkpoint
impl RefUnwindSafe for Checkpoint
impl Send for Checkpoint
impl Sync for Checkpoint
impl Unpin for Checkpoint
impl UnwindSafe for Checkpoint
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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