RopeCache class

Constructors

RopeCache({required int maxCtx, required int headDim, int? rotaryDim, double base = 10000.0, Device device = Device.CPU})
Build tables for positions [0, maxCtx) and head-dim headDim (must be even). base is the geometric-progression base for the frequency schedule (10000 for GPT-NeoX / Pythia; the same in LLaMA/Mistral). rotaryDim defaults to the full headDim; pass a smaller even number to only rotate a prefix of each head (GPT-NeoX rotary_pct convention).
factory

Properties

base double
final
device Device
final
hashCode int
The hash code for this object.
no setterinherited
headDim int
final
maxCtx int
final
rotaryDim int
Number of leading dimensions of each head that receive RoPE. For GPT-NeoX / Pythia this is headDim * rotary_pct (0.25 for 160m / 410m; 1.0 for LLaMA-style full rotation).
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

apply(Tensor qOrK, {int startPos = 0}) Tensor
Apply RoPE to a [N, headDim] query or key tensor whose rows correspond to absolute positions [startPos, startPos + N).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited