pub struct OpsPrep<Backward, B, S, C, const N: usize, Mode = Init> { /* private fields */ }
Expand description
Operation in preparation.
Each mode has its own set of functions to minimize cloning for unused backward states.
Implementations§
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N>
pub fn compute_bound(self) -> OpsPrep<BO, B, S, C, N, ComputePropertyDone>
pub fn compute_bound(self) -> OpsPrep<BO, B, S, C, N, ComputePropertyDone>
Indicates that the operation is compute bound, meaning its computation is heavy and should not be recomputed
pub fn memory_bound(self) -> OpsPrep<BO, B, S, C, N, MemoryBound>
pub fn memory_bound(self) -> OpsPrep<BO, B, S, C, N, MemoryBound>
Indicates that the operation is memory bound, meaning its computation is light and can be recomputed
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, MemoryBound>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, MemoryBound>
pub fn retro_forward<R>(
self,
retro_forward: R,
) -> OpsPrep<BO, B, S, C, N, MemoryBoundRetroForward>where
R: RetroForward,
pub fn retro_forward<R>(
self,
retro_forward: R,
) -> OpsPrep<BO, B, S, C, N, MemoryBoundRetroForward>where
R: RetroForward,
Registers the retro forward, if needed
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, MemoryBoundRetroForward>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, MemoryBoundRetroForward>
pub fn parents<'a, B2, A>(
self,
parents: A,
) -> OpsPrep<BO, B, S, C, N, ComputePropertyDone>where
B2: Backend,
A: IntoIterator<Item = &'a AutodiffTensor<B2>>,
pub fn parents<'a, B2, A>(
self,
parents: A,
) -> OpsPrep<BO, B, S, C, N, ComputePropertyDone>where
B2: Backend,
A: IntoIterator<Item = &'a AutodiffTensor<B2>>,
Checkpoints the parents, if needed
§impl<BO, B, C, const N: usize> OpsPrep<BO, B, (), C, N, ComputePropertyDone>
impl<BO, B, C, const N: usize> OpsPrep<BO, B, (), C, N, ComputePropertyDone>
pub fn stateless(
self,
output: <B as Backend>::FloatTensorPrimitive,
) -> AutodiffTensor<B>
pub fn stateless( self, output: <B as Backend>::FloatTensorPrimitive, ) -> AutodiffTensor<B>
Prepare a stateless operation.
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, ComputePropertyDone>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, ComputePropertyDone>
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, UnTracked>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, UnTracked>
pub fn finish(
self,
output: <B as Backend>::FloatTensorPrimitive,
) -> AutodiffTensor<B>
pub fn finish( self, output: <B as Backend>::FloatTensorPrimitive, ) -> AutodiffTensor<B>
Finish the preparation of an untracked operation and returns the output tensor.
§impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, Tracked>
impl<BO, B, S, C, const N: usize> OpsPrep<BO, B, S, C, N, Tracked>
pub fn finish(
self,
state: S,
output: <B as Backend>::FloatTensorPrimitive,
) -> AutodiffTensor<B>
pub fn finish( self, state: S, output: <B as Backend>::FloatTensorPrimitive, ) -> AutodiffTensor<B>
Finish the preparation of a tracked operation and returns the output tensor.
pub fn checkpoint(&mut self, tensor: &AutodiffTensor<B>) -> NodeID
pub fn checkpoint(&mut self, tensor: &AutodiffTensor<B>) -> NodeID
Checkpoints the tensor
Auto Trait Implementations§
impl<Backward, B, S, C, const N: usize, Mode> Freeze for OpsPrep<Backward, B, S, C, N, Mode>where
Backward: Freeze,
impl<Backward, B, S, C, const N: usize, Mode = Init> !RefUnwindSafe for OpsPrep<Backward, B, S, C, N, Mode>
impl<Backward, B, S, C, const N: usize, Mode> Send for OpsPrep<Backward, B, S, C, N, Mode>
impl<Backward, B, S, C, const N: usize, Mode = Init> !Sync for OpsPrep<Backward, B, S, C, N, Mode>
impl<Backward, B, S, C, const N: usize, Mode> Unpin for OpsPrep<Backward, B, S, C, N, Mode>
impl<Backward, B, S, C, const N: usize, Mode = Init> !UnwindSafe for OpsPrep<Backward, B, S, C, N, Mode>
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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