Skip to main content

Layer

Enum Layer 

Source
pub enum Layer {
Show 17 variants Input { dimensions: usize, }, Signal(Vec<Arc<dyn Operator>>), Embed(Vec<f64>), Dense { weights: Vec<f64>, bias: Vec<f64>, output_channels: usize, input_channels: usize, }, Flatten, GlobalPool(GlobalPoolMethod), Softmax, BatchNorm { epsilon: f64, }, Dropout { p: f64, }, CNN1D { weights: Vec<f64>, bias: Vec<f64>, output_channels: usize, input_channels: usize, kernel_size: usize, stride: usize, padding: usize, }, CNN2D { weights: Vec<f64>, bias: Vec<f64>, output_channels: usize, input_channels: usize, input_height: usize, input_width: usize, kernel_height: usize, kernel_width: usize, stride_height: usize, stride_width: usize, padding_height: usize, padding_width: usize, }, Propagate { edge_label: String, aggregation: AggregationKind, direction: Direction, }, Conv { edge_label: String, hop_weights: Vec<f64>, direction: Direction, }, Pool { edge_label: String, pool_size: usize, method: PoolMethod, direction: Direction, }, Attention, RNN { weights_input: Vec<f64>, weights_hidden: Vec<f64>, bias: Vec<f64>, hidden_channels: usize, input_channels: usize, return_sequences: bool, }, LSTM { weights_input: Vec<f64>, weights_hidden: Vec<f64>, bias: Vec<f64>, hidden_channels: usize, input_channels: usize, return_sequences: bool, },
}

Variants§

§

Input

Runtime-provided feature vector. This layer is a no-op during execution; it marks the expected input dimension for trained models that receive feature batches from an ML backend.

Fields

§dimensions: usize
§

Signal(Vec<Arc<dyn Operator>>)

Run a list of Operator signals, fuse them via log-odds conjunction at the configured alpha, then add the resulting logit to channel 0 as a residual connection.

§

Embed(Vec<f64>)

Initialize the channel map from a raw embedding vector. Element i becomes node i+1 with a single-channel value.

§

Dense

Fully connected: out = W @ input + bias, then gating.

Fields

§weights: Vec<f64>

output_channels x input_channels, row-major.

§bias: Vec<f64>
§output_channels: usize
§input_channels: usize
§

Flatten

Concatenate every node’s channel vector into a single vector.

§

GlobalPool(GlobalPoolMethod)

Reduce all spatial nodes to one vector.

§

Softmax

Numerically stable softmax per node.

§

BatchNorm

Per-channel batch normalization across all nodes.

Fields

§epsilon: f64
§

Dropout

Inference-mode dropout: scale every value by 1 - p.

Fields

§

CNN1D

One-dimensional CNN over sorted sequence positions.

Weights are row-major as output_channels x kernel_size x input_channels.

Fields

§weights: Vec<f64>
§bias: Vec<f64>
§output_channels: usize
§input_channels: usize
§kernel_size: usize
§stride: usize
§padding: usize
§

CNN2D

Two-dimensional CNN over flattened H x W x C spatial positions.

Weights are row-major as output_channels x kernel_height x kernel_width x input_channels.

Fields

§weights: Vec<f64>
§bias: Vec<f64>
§output_channels: usize
§input_channels: usize
§input_height: usize
§input_width: usize
§kernel_height: usize
§kernel_width: usize
§stride_height: usize
§stride_width: usize
§padding_height: usize
§padding_width: usize
§

Propagate

Propagate channel-0 scores through graph edges.

aggregation averages / sums / maxes the in-bounds neighbor probabilities; the resulting logit is added as a residual on channel 0. Requires ExecutionContext::graph.

Fields

§edge_label: String

Edge label to follow. An empty string selects every edge label.

§aggregation: AggregationKind
§direction: Direction
§

Conv

Weighted multi-hop graph convolution on channel 0.

hop_weights[0] is the self weight, hop_weights[i] weights the average over the hop-i neighbor ring. Weights are L1-normalized; the result is converted back to logit and added as a residual.

Fields

§edge_label: String

Edge label to follow. An empty string selects every edge label.

§hop_weights: Vec<f64>
§direction: Direction
§

Pool

Spatial downsampling via greedy BFS partitioning.

Groups pool_size neighboring nodes via BFS, aggregates their channel vectors element-wise (PoolMethod::{Avg, Max}), and keeps the smallest doc id as the representative.

Fields

§edge_label: String

Edge label to follow. An empty string selects every edge label.

§pool_size: usize
§method: PoolMethod
§direction: Direction
§

Attention

Self-attention across the per-node channel vectors with Q = K = V = X, scaled-dot-product, no learned projections.

§

RNN

Vanilla RNN over sorted sequence positions.

Weights are row-major as hidden_channels x input_channels and hidden_channels x hidden_channels.

Fields

§weights_input: Vec<f64>
§weights_hidden: Vec<f64>
§bias: Vec<f64>
§hidden_channels: usize
§input_channels: usize
§return_sequences: bool
§

LSTM

LSTM over sorted sequence positions.

Gate order is input, forget, candidate, output. Both weight matrices are row-major with 4 * hidden_channels rows.

Fields

§weights_input: Vec<f64>
§weights_hidden: Vec<f64>
§bias: Vec<f64>
§hidden_channels: usize
§input_channels: usize
§return_sequences: bool

Trait Implementations§

Source§

impl Clone for Layer

Source§

fn clone(&self) -> Layer

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Layer

§

impl !UnwindSafe for Layer

§

impl Freeze for Layer

§

impl Send for Layer

§

impl Sync for Layer

§

impl Unpin for Layer

§

impl UnsafeUnpin for Layer

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.