pub struct DeviceState<B: NeuralBackend, L> { /* private fields */ }Expand description
Fully device-resident state with one concrete value per architecture layer.
Implementations§
Source§impl<B: NeuralBackend, L> DeviceState<B, L>
impl<B: NeuralBackend, L> DeviceState<B, L>
Sourcepub fn create<E>(
layout: StateLayout,
create: impl FnMut(usize, &LayerCachePolicy) -> Result<L, E>,
) -> Result<Self, E>
pub fn create<E>( layout: StateLayout, create: impl FnMut(usize, &LayerCachePolicy) -> Result<L, E>, ) -> Result<Self, E>
Realizes every layer through a backend-specific construction closure.
Trait Implementations§
Source§impl<B: NeuralBackend, L> AsMut<[L]> for DeviceState<B, L>
impl<B: NeuralBackend, L> AsMut<[L]> for DeviceState<B, L>
Source§impl<B: NeuralBackend, L> AsRef<[L]> for DeviceState<B, L>
impl<B: NeuralBackend, L> AsRef<[L]> for DeviceState<B, L>
Source§impl<B: NeuralBackend, L: Clone> Clone for DeviceState<B, L>
impl<B: NeuralBackend, L: Clone> Clone for DeviceState<B, L>
Source§impl<B: Debug + NeuralBackend, L: Debug> Debug for DeviceState<B, L>
impl<B: Debug + NeuralBackend, L: Debug> Debug for DeviceState<B, L>
Source§impl<B, L> LayerRuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: RuntimeLayerState<B>,
impl<B, L> LayerRuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: RuntimeLayerState<B>,
Source§type LayerState = L
type LayerState = L
Concrete monomorphized layer state used by the architecture.
Source§fn layer(&mut self, layer: usize) -> Result<&mut Self::LayerState, StateError>
fn layer(&mut self, layer: usize) -> Result<&mut Self::LayerState, StateError>
Mutably borrows one architecture-global layer state.
Source§impl<B, L> ResettableRuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: ResettableRuntimeLayerState<B>,
impl<B, L> ResettableRuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: ResettableRuntimeLayerState<B>,
Source§fn reset_segment(&mut self, segment: &StateSegmentId) -> Result<(), StateError>
fn reset_segment(&mut self, segment: &StateSegmentId) -> Result<(), StateError>
Resets every layer in exactly one declared state segment.
Source§impl<B, L> RuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: RuntimeLayerState<B>,
impl<B, L> RuntimeState<B> for DeviceState<B, L>where
B: NeuralBackend,
L: RuntimeLayerState<B>,
Source§type RetainedValues<'a> = <L as RuntimeLayerState<B>>::RetainedValues<'a>
where
Self: 'a,
B::Tensor: 'a
type RetainedValues<'a> = <L as RuntimeLayerState<B>>::RetainedValues<'a> where Self: 'a, B::Tensor: 'a
Concrete iterator retaining native values for one execution unit.
Source§fn layout(&self) -> &StateLayout
fn layout(&self) -> &StateLayout
Returns the exact layout used to create this realization.
Source§fn retained_values(
&self,
_ordinal: usize,
address: ExecutionUnitAddress,
) -> Result<Self::RetainedValues<'_>, StateError>
fn retained_values( &self, _ordinal: usize, address: ExecutionUnitAddress, ) -> Result<Self::RetainedValues<'_>, StateError>
Borrows tensors retained by one execution unit without cloning handles. Read more
Auto Trait Implementations§
impl<B, L> Freeze for DeviceState<B, L>
impl<B, L> RefUnwindSafe for DeviceState<B, L>
impl<B, L> Send for DeviceState<B, L>
impl<B, L> Sync for DeviceState<B, L>
impl<B, L> Unpin for DeviceState<B, L>
impl<B, L> UnsafeUnpin for DeviceState<B, L>
impl<B, L> UnwindSafe for DeviceState<B, L>
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