pub struct PrefillInput {
pub input_ids: TensorRef,
pub attention_mask: Option<TensorRef>,
pub position_ids: Option<TensorRef>,
pub kv_cache: Option<Arc<dyn KvCacheHandle>>,
}Expand description
Input for prefill phase (processing the initial prompt)
Fields§
§input_ids: TensorRefInput token IDs [batch_size, sequence_length]
attention_mask: Option<TensorRef>Attention mask [batch_size, sequence_length] (optional)
position_ids: Option<TensorRef>Position IDs [batch_size, sequence_length] (optional, for RoPE)
kv_cache: Option<Arc<dyn KvCacheHandle>>Pre-allocated KV cache handle (optional, for paged attention)
Implementations§
Source§impl PrefillInput
impl PrefillInput
Sourcepub fn with_kv_cache(self, kv_cache: Arc<dyn KvCacheHandle>) -> Self
pub fn with_kv_cache(self, kv_cache: Arc<dyn KvCacheHandle>) -> Self
Create prefill input with a pre-allocated KV cache handle.
Sourcepub fn with_attention_mask(self, mask: TensorRef) -> Self
pub fn with_attention_mask(self, mask: TensorRef) -> Self
Add attention mask
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
Sourcepub fn sequence_length(&self) -> usize
pub fn sequence_length(&self) -> usize
Get sequence length
Trait Implementations§
Source§impl Clone for PrefillInput
impl Clone for PrefillInput
Source§fn clone(&self) -> PrefillInput
fn clone(&self) -> PrefillInput
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 PrefillInput
impl !RefUnwindSafe for PrefillInput
impl Send for PrefillInput
impl Sync for PrefillInput
impl Unpin for PrefillInput
impl UnsafeUnpin for PrefillInput
impl !UnwindSafe for PrefillInput
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