Skip to main content

DeviceState

Struct DeviceState 

Source
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>

Source

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.

Source

pub const fn stateless() -> Self

Creates an explicit rank-local realization with no mutable state slots.

Trait Implementations§

Source§

impl<B: NeuralBackend, L> AsMut<[L]> for DeviceState<B, L>

Source§

fn as_mut(&mut self) -> &mut [L]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<B: NeuralBackend, L> AsRef<[L]> for DeviceState<B, L>

Source§

fn as_ref(&self) -> &[L]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<B: NeuralBackend, L: Clone> Clone for DeviceState<B, L>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Debug + NeuralBackend, L: Debug> Debug for DeviceState<B, L>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<B, L> LayerRuntimeState<B> for DeviceState<B, L>

Source§

type LayerState = L

Concrete monomorphized layer state used by the architecture.
Source§

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>

Source§

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>

Source§

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

Returns the exact layout used to create this realization.
Source§

fn optional_layout(&self) -> Option<&StateLayout>

Returns state geometry, or None for an explicit rank with no mutable state. Read more
Source§

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>
where Vec<L>: Freeze, PhantomData<fn() -> B>: Freeze,

§

impl<B, L> RefUnwindSafe for DeviceState<B, L>

§

impl<B, L> Send for DeviceState<B, L>
where Vec<L>: Send, PhantomData<fn() -> B>: Send,

§

impl<B, L> Sync for DeviceState<B, L>
where Vec<L>: Sync, PhantomData<fn() -> B>: Sync,

§

impl<B, L> Unpin for DeviceState<B, L>
where Vec<L>: Unpin, PhantomData<fn() -> B>: Unpin,

§

impl<B, L> UnsafeUnpin for DeviceState<B, L>

§

impl<B, L> UnwindSafe for DeviceState<B, L>
where Vec<L>: UnwindSafe, PhantomData<fn() -> B>: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.