pub struct CheckpointManager { /* private fields */ }Expand description
Checkpoint manager
Implementations§
Source§impl CheckpointManager
impl CheckpointManager
Sourcepub fn new(config: CheckpointConfig) -> Self
pub fn new(config: CheckpointConfig) -> Self
Create new checkpoint manager
Sourcepub fn should_checkpoint(&self, layer_idx: usize) -> bool
pub fn should_checkpoint(&self, layer_idx: usize) -> bool
Check if layer should be checkpointed
Sourcepub fn save_checkpoint(&mut self, layer_idx: usize, activation: Tensor)
pub fn save_checkpoint(&mut self, layer_idx: usize, activation: Tensor)
Save checkpoint
Sourcepub fn get_checkpoint(&mut self, layer_idx: usize) -> Option<&Tensor>
pub fn get_checkpoint(&mut self, layer_idx: usize) -> Option<&Tensor>
Get checkpoint
Sourcepub fn recompute<F>(&mut self, layer_idx: usize, recompute_fn: F) -> Tensor
pub fn recompute<F>(&mut self, layer_idx: usize, recompute_fn: F) -> Tensor
Recompute activation (called during backward pass)
Sourcepub fn get_stats(&self) -> CheckpointStats
pub fn get_stats(&self) -> CheckpointStats
Get statistics
Auto Trait Implementations§
impl Freeze for CheckpointManager
impl !RefUnwindSafe for CheckpointManager
impl Send for CheckpointManager
impl Sync for CheckpointManager
impl Unpin for CheckpointManager
impl !UnwindSafe for CheckpointManager
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