#[repr(C)]pub struct RKLLMCrossAttnParam {
pub encoder_k_cache: *mut f32,
pub encoder_v_cache: *mut f32,
pub encoder_mask: *mut f32,
pub encoder_pos: *mut i32,
pub num_tokens: c_int,
}Expand description
@struct RKLLMCrossAttnParam @brief Structure holding parameters for cross-attention inference.
This structure is used when performing cross-attention in the decoder. It provides the encoder output (key/value caches), position indices, and attention mask.
encoder_k_cachemust be stored in contiguous memory with layout: [num_layers][num_tokens][num_kv_heads][head_dim]encoder_v_cachemust be stored in contiguous memory with layout: [num_layers][num_kv_heads][head_dim][num_tokens]
Fields§
§encoder_k_cache: *mut f32< Pointer to encoder key cache (size: num_layers * num_tokens * num_kv_heads * head_dim).
encoder_v_cache: *mut f32< Pointer to encoder value cache (size: num_layers * num_kv_heads * head_dim * num_tokens).
encoder_mask: *mut f32< Pointer to encoder attention mask (array of size num_tokens).
encoder_pos: *mut i32< Pointer to encoder token positions (array of size num_tokens).
num_tokens: c_int< Number of tokens in the encoder sequence.
Trait Implementations§
Source§impl Clone for RKLLMCrossAttnParam
impl Clone for RKLLMCrossAttnParam
Source§fn clone(&self) -> RKLLMCrossAttnParam
fn clone(&self) -> RKLLMCrossAttnParam
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 moreSource§impl Debug for RKLLMCrossAttnParam
impl Debug for RKLLMCrossAttnParam
impl Copy for RKLLMCrossAttnParam
Auto Trait Implementations§
impl Freeze for RKLLMCrossAttnParam
impl RefUnwindSafe for RKLLMCrossAttnParam
impl !Send for RKLLMCrossAttnParam
impl !Sync for RKLLMCrossAttnParam
impl Unpin for RKLLMCrossAttnParam
impl UnwindSafe for RKLLMCrossAttnParam
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