pub struct WaveNetLayerArray<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> {
pub layers: Vec<WaveNetLayer<COND, CH, K>>,
pub states: Vec<WaveNetLayerState>,
pub rechannel: DenseLayer<IN, CH>,
pub head_rechannel: DenseLayer<CH, HEAD>,
pub array_outputs: AlignedVec<f32>,
pub head_accum: AlignedVec<f32>,
pub head_outputs: AlignedVec<f32>,
pub receptive_field_size: usize,
pub block_size: usize,
pub block_buffer: AlignedVec<f32>,
pub effective_layers: usize,
}Expand description
Grouped Multi-Layer WaveNet Unit.
Fields§
§layers: Vec<WaveNetLayer<COND, CH, K>>Vec with structural topology (length defines blocks).
states: Vec<WaveNetLayerState>RingBuffer states, one for each Layer in the system.
rechannel: DenseLayer<IN, CH>Initial Dense tensor opening.
head_rechannel: DenseLayer<CH, HEAD>Final tensor closure generating Head projection.
array_outputs: AlignedVec<f32>Pre-allocated temporary output array. Array output temporary accumulator.
head_accum: AlignedVec<f32>CH-sized intermediate accumulator for layer contributions before the Head projection.
head_outputs: AlignedVec<f32>Allocated global Linear projection memory (HEAD-sized).
receptive_field_size: usizeDimensional field size (global receptive field) for routing.
block_size: usizeShared activation buffer size.
block_buffer: AlignedVec<f32>Temporary accumulator for blocks (pre-allocated).
effective_layers: usizeActive number of layers for soft-degrade. Set to layers.len() by default.
Implementations§
Source§impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> WaveNetLayerArray<IN, COND, CH, K, HEAD>
Sourcepub fn set_effective_layers(&mut self, n: usize)
pub fn set_effective_layers(&mut self, n: usize)
Sets the effective number of layers for soft-degrade. Clamped to [1, layers.len()].
Sourcepub unsafe fn process_block_internal<M: SimdMath, const PREWARM: bool>(
&mut self,
layer_inputs: &[f32],
condition: &[f32],
num_frames: usize,
prev_head_outputs: Option<&[f32]>,
)
pub unsafe fn process_block_internal<M: SimdMath, const PREWARM: bool>( &mut self, layer_inputs: &[f32], condition: &[f32], num_frames: usize, prev_head_outputs: Option<&[f32]>, )
Array’s central processing. Fully shielded against allocations.
When prev_head_outputs is Some, it is passed as seed in the
first layer’s WavenetProcessContext — the layer then fuses seed
accumulation with tanh in a single SIMD pass. This eliminates the
dedicated copy_from_slice of num_frames * CH bytes.
This implements the C++ cascaded head pattern (array N seeds its head accumulator with the post-head_rechannel output of array N−1).
§Safety
State pointers iterate internally without bounds checks.
Sourcepub unsafe fn prewarm_internal<M: SimdMath>(
&mut self,
layer_inputs: &[f32],
condition: &[f32],
prev_head_outputs: Option<&[f32]>,
)
pub unsafe fn prewarm_internal<M: SimdMath>( &mut self, layer_inputs: &[f32], condition: &[f32], prev_head_outputs: Option<&[f32]>, )
Processes data in Pre-warm mode to initialize and stabilize temporal memory.
[SCIENTIFIC EXPLANATION] Causal convolution neural networks like WaveNet have an internal state that actively depends on N past steps (Receptive Field). When loading a fresh model, the allocated network memory (Ring Buffers) contains “pure zeros” or computational garbage. Pre-warm feeds a continuous inert signal (Absolute Silence) into the network so as to fill the entire past window. The resulting cold-start transients “drain” silently into oblivion, ensuring the first audio sample when turning on the device sounds organic and stable, without pops or clicks.
§Safety
Call this via dispatch_simd! macro only.
Auto Trait Implementations§
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> Freeze for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> RefUnwindSafe for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> Send for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> Sync for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> Unpin for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> UnsafeUnpin for WaveNetLayerArray<IN, COND, CH, K, HEAD>
impl<const IN: usize, const COND: usize, const CH: usize, const K: usize, const HEAD: usize> UnwindSafe for WaveNetLayerArray<IN, COND, CH, K, HEAD>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.