---
title: "mropeRotaryEmbeddingQkVarlen"
sidebar_label: "mropeRotaryEmbeddingQkVarlen"
description: "Kotlin binding reference: mropeRotaryEmbeddingQkVarlen."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Ops](index.md)/[mropeRotaryEmbeddingQkVarlen](mropeRotaryEmbeddingQkVarlen.md)

# mropeRotaryEmbeddingQkVarlen

[common]\
fun [mropeRotaryEmbeddingQkVarlen](mropeRotaryEmbeddingQkVarlen.md)(query: [Tensor](../Tensor/index.md), key: [Tensor](../Tensor/index.md), positionIds: [Tensor](../Tensor/index.md), mropeSections: [LongArray](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long-array/index.html), interleavedSections: [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)? = null, theta: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, scaling: [RopeScaling](../RopeScaling/index.md)? = null, mode: [RotaryMode](../RotaryMode/index.md)? = null, rotaryDim: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)? = null, scale: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null): [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[Tensor](../Tensor/index.md)&gt;

`mropeRotaryEmbeddingQkVarlen(query: Tensor, key: Tensor, positionIds: Tensor, mropeSections: LongArray, interleavedSections: Boolean? = null, theta: Double? = null, scaling: RopeScaling? = null, mode: RotaryMode? = null, rotaryDim: Long? = null, scale: Double? = null)`: the `mrope_rotary_embedding_qk_varlen` operator. Multi-axis RoPE over a packed q/k pair: ONE per-token angle table serves both projections in a single call, the media-prefill pre-rotation shape. `query`/`key` are head-exposed `[n_tokens, heads, head_dim]` (a flat `[n_tokens, heads·head_dim]` projection reshapes to it as a free view; the rotation spans the TRAILING dim, so a flat row would rotate across head boundaries); `position_ids` is `[n_axes, n_tokens]` with `n_axes == mrope_sections.size()` (strip any trailing zero sections a checkpoint's metadata pads; the axis count follows the section list); `rotary_dim` bounds the rotated span (dims beyond it pass through) and defaults to the trailing dim. Rows whose per-axis positions are all EQUAL rotate exactly as the plain ops do; serve pure-text calls through `rotary_embedding*` (cheaper: no per-token table), and use this form for packs whose rows carry genuinely multi-axis positions, then attend with the rope inputs ABSENT so the attention op consumes (and appends) q/k exactly as given.