tidu 0.2.0

Automatic-differentiation transforms (linearize, transpose, eager reverse-mode) for primitive computation graphs.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use computegraph::graph::Graph;
use computegraph::GraphOperation;

/// Borrowed primitive computation graph passed to downstream executors.
pub struct PrimitiveGraph<'a, Op: GraphOperation> {
    graph: &'a Graph<Op>,
}

impl<'a, Op: GraphOperation> PrimitiveGraph<'a, Op> {
    pub(crate) fn new(graph: &'a Graph<Op>) -> Self {
        Self { graph }
    }

    /// Borrow the lower-level graph representation.
    pub fn as_graph(&self) -> &Graph<Op> {
        self.graph
    }
}