Skip to main content

RopeTrainParams

Struct RopeTrainParams 

Source
pub struct RopeTrainParams {
    pub batch: u32,
    pub n_heads: u32,
    pub seq_len: u32,
    pub head_dim: u32,
    pub rope_dim: u32,
    pub theta_base: f32,
    pub sections: [u32; 4],
}
Expand description

Shape + frequency parameters for a differentiable RoPE dispatch.

Non-IMROPE (plain NeoX RoPE) is expressed as sections = [head_dim/2, 0, 0, 0] with mode = Imrope — all pairs fall into axis 0 (text time-axis) which is the only axis used. Alternatively, callers can use rope_multi directly with mode = Mrope and sections = [rope_dim/2, 0, 0, 0].

Fields§

§batch: u32§n_heads: u32

Number of query/key heads.

§seq_len: u32§head_dim: u32

Full head dimension (must be even).

§rope_dim: u32

Number of dimensions that participate in rotation (≤ head_dim, even). Pairs [rope_dim/2, head_dim/2) pass through unchanged.

§theta_base: f32

Base frequency (theta). Qwen3.5/3.6: 1_000_000.0 = 1e6.

Note: the metal shader comment in test_rope_multi.rs line 347 uses 1e7; the Qwen3.5 model config uses rope_theta = 1_000_000 = 1e6. The caller MUST pass the value that matches the model’s GGUF <prefix>.rope.freq_base key.

§sections: [u32; 4]

Section counts [s0, s1, s2, s3] for IMROPE / MROPE.

Qwen3.5 / Qwen3.6: [11, 11, 10, 0] (IMROPE, matches /opt/hf2q/src/inference/models/qwen35/mod.rs:235).

Sum s0+s1+s2+s3 should equal rope_dim / 2 for full rotary-section coverage. The kernel tolerates sums smaller than rope_dim/2 (sectors wrap modulo the sum), but callers should pass the canonical value from the model config.

For non-IMROPE plain NeoX: [rope_dim/2, 0, 0, 0] with MROPE mode puts every pair in axis-0 (time).

Trait Implementations§

Source§

impl Clone for RopeTrainParams

Source§

fn clone(&self) -> RopeTrainParams

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RopeTrainParams

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for RopeTrainParams

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.