/** * RoPE (Rotary Position Embedding) operations */ import type { WebInferContext } from '../core/context.ts'; import type { Tensor } from '../core/tensor.ts'; /** * Apply RoPE (Rotary Position Embedding) in-place * * Applies rotary position embeddings to query and key tensors. * Modifies tensors in-place. * * @param ctx WebInfer context * @param q Query tensor [nnz, num_qo_heads, head_dim] * @param k Key tensor [nnz, num_kv_heads, head_dim] * @param indptr Indirection pointer [batch_size + 1] * @param offsets Position offsets for each batch item [batch_size] * @param rope_scale RoPE scale factor (default: 1.0) * @param rope_theta RoPE theta base (default: 10000.0) */ export declare function apply_rope_inplace(ctx: WebInferContext, q: Tensor, k: Tensor, indptr: Tensor, offsets: Tensor, rope_scale?: number, rope_theta?: number): Promise; /** * Apply Llama 3.1 RoPE variant in-place * * Applies Llama 3.1's frequency-scaled RoPE for long context support. * Modifies tensors in-place. * * @param ctx WebInfer context * @param q Query tensor [nnz, num_qo_heads, head_dim] * @param k Key tensor [nnz, num_kv_heads, head_dim] * @param indptr Indirection pointer [batch_size + 1] * @param offsets Position offsets [batch_size] * @param low_freq_factor Low frequency scaling factor (default: 1.0) * @param high_freq_factor High frequency scaling factor (default: 4.0) * @param old_context_len Original context length before scaling (default: 8192) * @param rope_theta RoPE theta base (default: 500000.0) */ export declare function apply_llama31_rope_inplace(ctx: WebInferContext, q: Tensor, k: Tensor, indptr: Tensor, offsets: Tensor, low_freq_factor?: number, high_freq_factor?: number, old_context_len?: number, rope_theta?: number): Promise;