FastGRNN

Struct FastGRNN 

Source
pub struct FastGRNN { /* private fields */ }
Expand description

FastGRNN model for neural routing

Implementations§

Source§

impl FastGRNN

Source

pub fn new(config: FastGRNNConfig) -> Result<Self>

Create a new FastGRNN model with the given configuration

Source

pub fn load<P: AsRef<Path>>(_path: P) -> Result<Self>

Load model from a file (safetensors format)

Source

pub fn save<P: AsRef<Path>>(&self, _path: P) -> Result<()>

Save model to a file (safetensors format)

Source

pub fn forward( &self, input: &[f32], initial_hidden: Option<&[f32]>, ) -> Result<f32>

Forward pass through the FastGRNN model

§Arguments
  • input - Input vector (sequence of features)
  • initial_hidden - Optional initial hidden state
§Returns

Output score (typically between 0.0 and 1.0 after sigmoid)

Source

pub fn forward_batch(&self, inputs: &[Vec<f32>]) -> Result<Vec<f32>>

Batch inference for multiple inputs

Source

pub fn quantize(&mut self) -> Result<()>

Quantize the model to INT8

Source

pub fn prune(&mut self, sparsity: f32) -> Result<()>

Apply magnitude-based pruning

Source

pub fn size_bytes(&self) -> usize

Get model size in bytes

Source

pub fn config(&self) -> &FastGRNNConfig

Get configuration

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> 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, 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V