|
pulsatrix
|
Owns every Node in a computation graph and exposes read access for graph-walking code (autograd's backward pass, Phase 2+ explainers). More...
#include <computation_graph.hpp>
Public Member Functions | |
| NodeId | add_node (OpType op_type, Shape shape, std::optional< std::string > label=std::nullopt, std::vector< NodeId > parent_ids={}) |
| Adds a node to the graph and wires it to its parents. | |
| const Node & | node (NodeId id) const |
| Looks up a node by id. | |
| size_t | node_count () const |
| Number of nodes currently in the graph. | |
| std::vector< NodeId > | nodes_by_op_type (OpType op_type) const |
| Finds every node with the given op type. | |
| std::vector< NodeId > | topological_order () const |
| Returns every node id in a valid topological order (every node after all its parents). | |
Owns every Node in a computation graph and exposes read access for graph-walking code (autograd's backward pass, Phase 2+ explainers).
| NodeId pulsatrix::ComputationGraph::add_node | ( | OpType | op_type, |
| Shape | shape, | ||
| std::optional< std::string > | label = std::nullopt, |
||
| std::vector< NodeId > | parent_ids = {} |
||
| ) |
Adds a node to the graph and wires it to its parents.
| op_type | The operation category this node represents. |
| shape | This node's output shape. |
| label | Optional human-readable label. |
| parent_ids | Ids of this node's parents. Every id must already exist in the graph (i.e. refer to a node added by an earlier call) – this constraint is what guarantees insertion order is already a valid topological order. |
|
inline |
Number of nodes currently in the graph.
Finds every node with the given op type.
| op_type | Op type to match. |
| std::vector< NodeId > pulsatrix::ComputationGraph::topological_order | ( | ) | const |
Returns every node id in a valid topological order (every node after all its parents).