pub struct DecodeInput {
pub input_ids: TensorRef,
pub kv_cache: Arc<dyn KvCacheHandle>,
pub position_ids: Option<TensorRef>,
}Expand description
Input for decode phase (generating one token at a time)
Fields§
§input_ids: TensorRefInput token ID for current step [batch_size, 1]
kv_cache: Arc<dyn KvCacheHandle>Existing KV cache from previous steps
position_ids: Option<TensorRef>Position IDs for current step [batch_size, 1] (optional)
Implementations§
Source§impl DecodeInput
impl DecodeInput
Sourcepub fn new(input_ids: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
pub fn new(input_ids: TensorRef, kv_cache: Arc<dyn KvCacheHandle>) -> Self
Create new decode input
Sourcepub fn with_position_ids(self, positions: TensorRef) -> Self
pub fn with_position_ids(self, positions: TensorRef) -> Self
Add position IDs
Sourcepub fn batch_size(&self) -> usize
pub fn batch_size(&self) -> usize
Get batch size
Trait Implementations§
Source§impl Clone for DecodeInput
impl Clone for DecodeInput
Source§fn clone(&self) -> DecodeInput
fn clone(&self) -> DecodeInput
Returns a duplicate of the value. Read more
1.0.0 · 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 Freeze for DecodeInput
impl !RefUnwindSafe for DecodeInput
impl Send for DecodeInput
impl Sync for DecodeInput
impl Unpin for DecodeInput
impl UnsafeUnpin for DecodeInput
impl !UnwindSafe for DecodeInput
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