---
title: "ClikaRT::ops::generate_rotary_cache"
sidebar_label: "generate_rotary_cache"
description: "The rotary angle tables of one context-scaling family: cos and sin, each [max_positions, rotary_dim / 2] Float32."
---

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

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

## generate\_rotary\_cache() {#generate_rotary_cache}

<div class="api-signature">

`std::array<`[`Tensor`](../Tensor.md) `2>` **`generate_rotary_cache`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `rotary_dim`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int64_t` `max_positions`,<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<double>` `scale` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `low_freq_factor` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `high_freq_factor` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<int64_t>` `original_max_pos` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `beta_fast` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<double>` `beta_slow` `=` `std::nullopt`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`OptionalTensor`](../../index.md#OptionalTensor) `freq_factors` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;[`StreamOrDevice`](../StreamOrDevice.md) `device` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::optional<bool>` `yarn_truncate` `=` `std::nullopt`<br />
)

</div>

The rotary angle tables of one context-scaling family: [`cos`](./cos.md#cos) and [`sin`](./sin.md#sin), each `[max_positions, rotary_dim / 2]` Float32.

**Parameters**

- `yarn_truncate`: YaRN's correction window: `true` (the default) rounds its two bounds to whole bands, `false` keeps the fractional bounds the parameters name (a checkpoint whose rope parameters set `truncate` off). The other families ignore it.

**Returns:** a 2-element array \{cos, sin\}.

<div class="api-declared">

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

</div>
