vllm.model_executor.layers.rotary_embedding.common
¶
Classes:
ApplyRotaryEmb
¶
Bases: CustomOp
Methods:
-
forward_static–Args:
forward_static(x, cos, sin, is_neox_style=True, enable_fp32_compute=False)
staticmethod
¶
Args: x: [batch_size (optional), seq_len, num_heads, head_size] cos: [seq_len, head_size // 2] sin: [seq_len, head_size // 2] is_neox_style: Whether to use the Neox-style or GPT-J-style. enable_fp32_compute: Temporarily convert x, cos, sin to FP32 dtype for higher accuracy.
_flashinfer_rotary_embedding(positions, query, key, head_size, cos_sin_cache, is_neox)
¶
Custom op wrapper for flashinfer's rotary embedding.
This is an in-place operation that modifies query and key tensors directly.