rustyasg 0.4.1

Graph-based deep learning framework in Rust: define-then-run ASG, graph-to-graph autograd, wgpu GPU backend, and an interactive egui graph visualizer.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Module defining the core `Module` trait for all neural network layers.

use crate::tensor::Tensor;

/// Trait defining the common interface for all layers/modules.
///
/// In the graph-based architecture, `Module` is any component that can
/// add a specific pattern of operations and parameters to the graph.
pub trait Module {
    /// Performs a "symbolic" forward pass, building the corresponding part of the graph.
    ///
    /// Takes an input symbolic tensor and returns an output symbolic tensor.
    fn forward(&self, inputs: &Tensor) -> Tensor;

    /// Returns a list of all trainable parameters (as symbolic tensors)
    /// that belong to this module.
    fn parameters(&self) -> Vec<Tensor>;
}