pub struct CheckpointedActivation { /* private fields */ }Expand description
A checkpointed activation: stores only the input and recomputes the
output on demand via the associated CheckpointSegment.
Implementations§
Source§impl CheckpointedActivation
impl CheckpointedActivation
Sourcepub fn new(segment: CheckpointSegment, input: Vec<f32>) -> Self
pub fn new(segment: CheckpointSegment, input: Vec<f32>) -> Self
Create a new checkpointed activation.
Sourcepub fn recompute(&self) -> Result<Vec<f32>, CheckpointError>
pub fn recompute(&self) -> Result<Vec<f32>, CheckpointError>
Recompute the output from the saved input.
Sourcepub fn memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Memory actually consumed by this checkpoint (input only, in bytes).
Sourcepub fn full_memory_bytes(&self) -> usize
pub fn full_memory_bytes(&self) -> usize
Memory that would be consumed if both input and output were stored.
Sourcepub fn memory_savings(&self) -> f32
pub fn memory_savings(&self) -> f32
Fraction of memory saved compared to the full (non-checkpointed) case.
Returns a value in [0.0, 1.0].
Auto Trait Implementations§
impl Freeze for CheckpointedActivation
impl RefUnwindSafe for CheckpointedActivation
impl Send for CheckpointedActivation
impl Sync for CheckpointedActivation
impl Unpin for CheckpointedActivation
impl UnsafeUnpin for CheckpointedActivation
impl UnwindSafe for CheckpointedActivation
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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