mlx_rs::nn

Type Alias Sinpe

Source
pub type Sinpe = SinusoidalPositionalEncoding;
Expand description

Aliased Type§

struct Sinpe {
    pub scale: f32,
    pub cosine_first: bool,
    /* private fields */
}

Fields§

§scale: f32

multiplicative scale for the embeddings. Default is sqrt(2/dimensions)

§cosine_first: bool

if true embed using [cos(x), sin(x)] instead of the reverse

Implementations§

Source§

impl Sinpe

Source

pub const DEFAULT_COSINE_FIRST: bool = false

Default value for cosine_first field.

Source

pub const DEFAULT_MIN_FREQUENCY: f32 = 9.99999974E-5f32

Default value for min frequency.

Source

pub const DEFAULT_MAX_FREQUENCY: f32 = 1f32

Default value for max frequency.

Source

pub const DEFAULT_FULL_TURNS: bool = false

Default value for full turns.

Trait Implementations§

Source§

impl Module<&Array> for Sinpe

Source§

type Error = Exception

Error type for the module.
Source§

type Output = Array

Output type of the module.
Source§

fn forward(&mut self, x: &Array) -> Result<Self::Output, Self::Error>

Forward pass of the module.
Source§

fn training_mode(&mut self, _mode: bool)

Set whether the module is in training mode. Read more