pub struct LayerwisePolicyForward<'a, B, U, P>where
B: NeuralBackend,
P: LayerwisePolicy<B, U>,{ /* private fields */ }Expand description
Failure-safe ownership of one policy forward and its current unit lease.
Implementations§
Source§impl<'a, B, U, P> LayerwisePolicyForward<'a, B, U, P>where
B: NeuralBackend,
P: LayerwisePolicy<B, U>,
impl<'a, B, U, P> LayerwisePolicyForward<'a, B, U, P>where
B: NeuralBackend,
P: LayerwisePolicy<B, U>,
Sourcepub fn begin(
policy: &'a mut P,
initial: &B::Tensor,
context: &'a <B::Tensor as Tensor>::Context,
) -> Result<Self, P::Error>
pub fn begin( policy: &'a mut P, initial: &B::Tensor, context: &'a <B::Tensor as Tensor>::Context, ) -> Result<Self, P::Error>
Begins one failure-safe policy transaction.
Sourcepub fn acquire<E, F>(
&mut self,
ordinal: usize,
address: ExecutionUnitAddress,
build: F,
) -> Result<&mut P::Lease, LayerwiseAcquireError<E, P::Error>>
pub fn acquire<E, F>( &mut self, ordinal: usize, address: ExecutionUnitAddress, build: F, ) -> Result<&mut P::Lease, LayerwiseAcquireError<E, P::Error>>
Acquires one unit and retains its lease until completion or abort.
Trait Implementations§
Source§impl<B, U, P> Drop for LayerwisePolicyForward<'_, B, U, P>where
B: NeuralBackend,
P: LayerwisePolicy<B, U>,
impl<B, U, P> Drop for LayerwisePolicyForward<'_, B, U, P>where
B: NeuralBackend,
P: LayerwisePolicy<B, U>,
Auto Trait Implementations§
impl<'a, B, U, P> !UnwindSafe for LayerwisePolicyForward<'a, B, U, P>
impl<'a, B, U, P> Freeze for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: Freeze,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: Freeze,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: Freeze,
PhantomData<fn() -> U>: Freeze,
impl<'a, B, U, P> RefUnwindSafe for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: RefUnwindSafe,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: RefUnwindSafe,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: RefUnwindSafe,
PhantomData<fn() -> U>: RefUnwindSafe,
impl<'a, B, U, P> Send for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: Send,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: Send,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: Send,
PhantomData<fn() -> U>: Send,
impl<'a, B, U, P> Sync for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: Sync,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: Sync,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: Sync,
PhantomData<fn() -> U>: Sync,
impl<'a, B, U, P> Unpin for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: Unpin,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: Unpin,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: Unpin,
PhantomData<fn() -> U>: Unpin,
impl<'a, B, U, P> UnsafeUnpin for LayerwisePolicyForward<'a, B, U, P>where
&'a mut P: UnsafeUnpin,
&'a <<B as NeuralBackend>::Tensor as Tensor>::Context: UnsafeUnpin,
Option<(usize, ExecutionUnitAddress, <P as LayerwisePolicy<B, U>>::Lease)>: UnsafeUnpin,
PhantomData<fn() -> U>: UnsafeUnpin,
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