pub struct JitRecurrent<J: RecurrentJit> {
pub jit: J,
pub last_timing: StepTiming,
/* private fields */
}Expand description
Wraps a recurrent JIT and its host-side LSTM state. Owns the head read buffer so callers can borrow the non-state output between steps.
Fields§
§jit: J§last_timing: StepTimingImplementations§
Source§impl<J: RecurrentJit> JitRecurrent<J>
impl<J: RecurrentJit> JitRecurrent<J>
Sourcepub fn new(jit: J, state: LstmState, head_len: usize) -> Result<Self>
pub fn new(jit: J, state: LstmState, head_len: usize) -> Result<Self>
Construct from a prepared JIT, the initial state, and the declared
head length in f32 elements. The JIT’s output buffer is read once
and its size is checked against head_len + |h| + |c| to catch
build-closure layout drift at construction time instead of letting
silently mis-split output corrupt downstream values.
pub fn state(&self) -> &LstmState
pub fn state_mut(&mut self) -> &mut LstmState
pub fn head_len(&self) -> usize
Sourcepub fn step<F>(&mut self, pack_inputs: F) -> Result<&[f32]>
pub fn step<F>(&mut self, pack_inputs: F) -> Result<&[f32]>
One recurrent step. pack_inputs writes per-step non-state inputs
(audio chunk, token id, encoder frame, …) into the JIT. The wrapper
then packs state, executes, splits the output into
[head | h_tail | c_tail], and updates host state. Returns the head
slice borrowed from the wrapper-owned buffer.
Auto Trait Implementations§
impl<J> Freeze for JitRecurrent<J>where
J: Freeze,
impl<J> RefUnwindSafe for JitRecurrent<J>where
J: RefUnwindSafe,
impl<J> Send for JitRecurrent<J>where
J: Send,
impl<J> Sync for JitRecurrent<J>where
J: Sync,
impl<J> Unpin for JitRecurrent<J>where
J: Unpin,
impl<J> UnsafeUnpin for JitRecurrent<J>where
J: UnsafeUnpin,
impl<J> UnwindSafe for JitRecurrent<J>where
J: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more