Skip to main content

ClikaRT::ops::generate_rotary_cache

function

generate_rotary_cache()​

std::array<Tensor 2> generate_rotary_cache(
    int64_t rotary_dim,
    int64_t max_positions,
    std::optional<double> theta = std::nullopt,
    std::optional<RopeScaling> scaling = std::nullopt,
    std::optional<double> scale = std::nullopt,
    std::optional<double> low_freq_factor = std::nullopt,
    std::optional<double> high_freq_factor = std::nullopt,
    std::optional<int64_t> original_max_pos = std::nullopt,
    std::optional<double> beta_fast = std::nullopt,
    std::optional<double> beta_slow = std::nullopt,
    OptionalTensor freq_factors = {},
    StreamOrDevice device = {},
    std::optional<bool> yarn_truncate = std::nullopt
)

The rotary angle tables of one context-scaling family: cos and 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}.

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