Skip to main content

OptionalInitialLstmState

Trait OptionalInitialLstmState 

pub trait OptionalInitialLstmState<const D: usize> {
    // Required method
    fn unwrap_or_initial<S>(self, shape: S, device: &Device) -> LstmState<D>
       where S: Into<Shape>;
}
Expand description

Extension trait for attaching an initializer to an Option<LstmState>.

Required Methods§

fn unwrap_or_initial<S>(self, shape: S, device: &Device) -> LstmState<D>
where S: Into<Shape>,

Unwrap the optional state, or allocate initial state.

§Arguments
  • shape - the shape of the cell and hidden states.
  • device - the device to allocate the state on.
§Returns

Either self unwrapped, or allocate using LstmState::initial.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

§

impl<const D: usize> OptionalInitialLstmState<D> for Option<LstmState<D>>

§

fn unwrap_or_initial<S>(self, shape: S, device: &Device) -> LstmState<D>
where S: Into<Shape>,

Implementors§