Skip to main content

NeuralFeatureMap

Trait NeuralFeatureMap 

Source
pub trait NeuralFeatureMap: Send + Sync {
    // Required methods
    fn forward(&self, input: &[f64]) -> Result<Vec<f64>>;
    fn parameters_mut(&mut self) -> &mut [f64];
    fn parameters(&self) -> &[f64];
    fn parameter_count(&self) -> usize;
    fn input_dim(&self) -> usize;
    fn output_dim(&self) -> usize;
}
Expand description

A differentiable map ℝ^{d_in} → ℝ^{d_out} used as the feature extractor inside a Deep Kernel.

Implementations must be deterministic given their parameters (so forward(x) produces the same output for the same input at any point in time), and must be Send + Sync so they can be shared across threads like every other crate-level kernel.

Required Methods§

Source

fn forward(&self, input: &[f64]) -> Result<Vec<f64>>

Map an input vector to feature space.

Source

fn parameters_mut(&mut self) -> &mut [f64]

Mutable view of the flat parameter vector (weights + biases, in layer order). Exposed as &mut [f64] so that optimisers can apply updates in place without owning the extractor.

Source

fn parameters(&self) -> &[f64]

Immutable view of the flat parameter vector.

Source

fn parameter_count(&self) -> usize

Number of trainable scalar parameters.

Source

fn input_dim(&self) -> usize

Input dimension expected by forward.

Source

fn output_dim(&self) -> usize

Output dimension produced by forward.

Implementors§