pub struct DecodeOutput {
pub logits: TensorRef,
pub kv_cache: Arc<dyn KvCacheHandle>,
pub recurrent_state: Option<Arc<dyn RecurrentStateHandle>>,
pub hidden_state: Option<TensorRef>,
pub attention_weights: Option<Vec<TensorRef>>,
}Expand description
Output from decode phase
Fields§
§logits: TensorRefLogits for next token [batch_size, vocab_size]
kv_cache: Arc<dyn KvCacheHandle>Updated KV cache with new token state
recurrent_state: Option<Arc<dyn RecurrentStateHandle>>Updated recurrent state, when used.
Hidden state for current token (optional)
attention_weights: Option<Vec<TensorRef>>Attention weights for current token (optional)
Implementations§
Source§impl DecodeOutput
impl DecodeOutput
Sourcepub fn new(logits: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
pub fn new(logits: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
Create new decode output
Sourcepub fn with_recurrent_state(
self,
recurrent_state: Arc<dyn RecurrentStateHandle>,
) -> Self
pub fn with_recurrent_state( self, recurrent_state: Arc<dyn RecurrentStateHandle>, ) -> Self
Attach updated recurrent state to the decode output.
Trait Implementations§
Source§impl Clone for DecodeOutput
impl Clone for DecodeOutput
Source§fn clone(&self) -> DecodeOutput
fn clone(&self) -> DecodeOutput
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for DecodeOutput
impl !UnwindSafe for DecodeOutput
impl Freeze for DecodeOutput
impl Send for DecodeOutput
impl Sync for DecodeOutput
impl Unpin for DecodeOutput
impl UnsafeUnpin for DecodeOutput
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