---
title: "ClikaRT::ops::mrope_rotary_embedding"
sidebar_label: "mrope_rotary_embedding"
description: "Multi-section rotary position embedding over padded layouts. Multi-section RoPE (the multimodal form): the head dimension is split into mrope_sections, and each section takes its angles from its OWN r…"
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--function">function</span>

## mrope\_rotary\_embedding() {#mrope_rotary_embedding}

<div class="api-signature">

[`Tensor`](../Tensor.md) **`mrope_rotary_embedding`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `input`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`Tensor`](../Tensor.md) `position_ids`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`ClikaRT::Span`](../Span.md)`<const std::int64_t>` `mrope_sections`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<bool>` `interleaved_sections` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `theta` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`RopeScaling`](./index.md#RopeScaling)`>` `scaling` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<`[`RotaryMode`](./index.md#RotaryMode)`>` `mode` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<int64_t>` `rotary_dim` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `scale` `=` `std::nullopt`<br />
)

</div>

Multi-section rotary position embedding over padded layouts.

Multi-section RoPE (the multimodal form): the head dimension is split into `mrope_sections`, and each section takes its angles from its OWN row of `position_ids` (e.g. temporal/height/width position streams). `interleaved_sections` picks the section layout; `theta` overrides the frequency base.

**Throws**

- `ClikaRT::Error`: when the input's dtype/shape is not served for this operation (the machine-readable reason rides `code_name()`).

**Returns:** `input` rotated; same shape and dtype.

<div class="api-declared">

Declared in `ClikaRT/compute/ops.h`, line 2218

</div>
