Skip to main content

RuntimeState

Trait RuntimeState 

Source
pub trait RuntimeState<B: NeuralBackend> {
    type RetainedValues<'a>: Iterator<Item = &'a B::Tensor>
       where Self: 'a,
             B::Tensor: 'a;

    // Required methods
    fn layout(&self) -> &StateLayout;
    fn retained_values(
        &self,
        ordinal: usize,
        address: ExecutionUnitAddress,
    ) -> Result<Self::RetainedValues<'_>, StateError>;

    // Provided method
    fn optional_layout(&self) -> Option<&StateLayout> { ... }
}
Expand description

Mutable state realization consumed by generic resident and layerwise engines.

Required Associated Types§

Source

type RetainedValues<'a>: Iterator<Item = &'a B::Tensor> where Self: 'a, B::Tensor: 'a

Concrete iterator retaining native values for one execution unit.

Required Methods§

Source

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>

Borrows tensors retained by one execution unit without cloning handles.

The flat ordinal addresses policy storage while address preserves architecture-group semantics for composite and shared state.

Provided Methods§

Source

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

Returns state geometry, or None for an explicit rank with no mutable state.

Existing stateful realizations inherit the strict layout. Stateless implementations override this method so generic session control never invents sentinel state geometry.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

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