Skip to main content

ConvNetModel

Struct ConvNetModel 

Source
pub struct ConvNetModel {
    pub blocks: Vec<ConvNetBlock>,
    pub head_scale: f32,
    pub receptive_field_size: usize,
    pub post_stack_head: Option<PostStackHead>,
    pub head_output_scratch: AlignedVec<f32>,
    pub prewarm_on_reset: bool,
    pub linear_head: Option<LinearHead>,
    /* private fields */
}
Expand description

ConvNet feed-forward model.

Composed of a sequence of ConvNetBlocks chained sequentially, followed by an optional PostStackHead and a final head_scale gain.

Unlike WaveNet, ConvNet has no gating, no rechannel projections, no condition_dsp, and no dual-array architecture. Each block’s output is the input of the next block directly.

Fields§

§blocks: Vec<ConvNetBlock>

Sequential ConvNet blocks.

§head_scale: f32

Final voltage compensation scale (Target Output Scale).

§receptive_field_size: usize

Total receptive field (sum of all block RFs + head RF contribution).

§post_stack_head: Option<PostStackHead>

Optional post-stack head sub-object (Conv1D + activation).

§head_output_scratch: AlignedVec<f32>

Scratch buffer for post-stack head output.

§prewarm_on_reset: bool

Whether to execute prewarm during reset(). Default: true.

§linear_head: Option<LinearHead>

Optional C++ flat-format linear head weights (no activation). Used when post_stack_head is None but the model has a separate linear projection from in_ch → out_ch.

Implementations§

Source§

impl ConvNetModel

Source

pub fn in_channels(&self) -> usize

Returns the number of input channels expected by the first block.

Source

pub fn out_channels(&self) -> usize

Returns the number of output channels produced by the model.

Source

pub fn process(&mut self, input: &[f32], output: &mut [f32])

Resolves the full forward pass and produces waveform samples in zero allocation (DSP).

Source

pub fn prewarm(&mut self)

Stabilizes the model by processing silence (Zero Input) for pre-warm.

Trait Implementations§

Source§

impl NamModel for ConvNetModel

Source§

fn process(&mut self, input: &[f32], output: &mut [f32])

Invoked by the DSP RT-Thread to process acoustic sample blocks (Float32).
Source§

fn prewarm(&mut self, _num_samples: usize)

“Heats up” the virtual tubes of the neural engine (prewarm).
Source§

fn prewarm_samples(&self) -> usize

Returns the number of samples needed to fully stabilize the model’s internal state (receptive field / recurrent memory depth). Read more
Source§

fn set_max_buffer_size(&mut self, _max_buf: usize) -> Result<()>

Reallocates internal buffers to support the given maximum block size. Read more
Source§

fn prewarm_on_reset(&self) -> bool

Returns whether prewarm should be executed on reset(). Read more
Source§

fn set_prewarm_on_reset(&mut self, val: bool)

Sets whether prewarm should be executed on reset(). Read more
Source§

fn reset(&mut self, _sample_rate: u32, max_buffer_size: usize) -> Result<()>

Resets the model’s internal state with a new sample rate and max buffer size. Read more
Source§

fn slimmable_breakpoints(&self) -> Vec<f64>

Returns the breakpoints at which slimmable quality transitions occur. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

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.