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

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

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

# rotaryEmbedding

[common]\
fun [rotaryEmbedding](rotaryEmbedding.md)(input: [Tensor](../Tensor/index.md), positionIds: [Tensor](../Tensor/index.md)? = null, cos: [Tensor](../Tensor/index.md)? = null, sin: [Tensor](../Tensor/index.md)? = null, mode: [RotaryMode](../RotaryMode/index.md)? = null, rotaryDim: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)? = null, theta: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, scaling: [RopeScaling](../RopeScaling/index.md)? = null, scale: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, lowFreqFactor: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, highFreqFactor: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, originalMaxPos: [Long](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html)? = null, betaFast: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, betaSlow: [Double](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)? = null, freqFactors: [Tensor](../Tensor/index.md)? = null): [Tensor](../Tensor/index.md)

`rotaryEmbedding(input: Tensor, positionIds: Tensor? = null, cos: Tensor? = null, sin: Tensor? = null, mode: RotaryMode? = null, rotaryDim: Long? = null, theta: Double? = null, scaling: RopeScaling? = null, scale: Double? = null, lowFreqFactor: Double? = null, highFreqFactor: Double? = null, originalMaxPos: Long? = null, betaFast: Double? = null, betaSlow: Double? = null, freqFactors: Tensor? = null)`: the `rotary_embedding` operator. Rotary position embedding over padded `[.., S, D]` layouts. Rotates the leading `rotary_dim` of each head vector by per-position angles (RoPE). `cos` / `sin` are the precomputed angle planes `[max_pos, rotary_dim/2]` Float32; `position_ids` (Int32/Int64) selects each token's row; absent, positions run 0, 1, 2, … per sequence. `mode` picks the pair layout (interleaved vs half-split); `rotary_dim` absent rotates the whole head dim.