pub struct Node {
pub id: NodeId,
pub label: String,
pub kind: NodeKind,
pub target: Option<String>,
}Expand description
A node in the computational graph.
Fields§
§id: NodeIdUnique id within the graph; edges and trained states refer to it.
label: StringHuman-readable name shown in diagrams; cosmetic, excluded from the architecture fingerprint.
kind: NodeKindWhat kind of computation this node represents.
target: Option<String>Execution target: “local” (reserved, always local), or a worker tag. None means: use default (remote if workers available, else local).
Implementations§
Source§impl Node
impl Node
Sourcepub fn new(
id: impl Into<String>,
label: impl Into<String>,
filter_name: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, label: impl Into<String>, filter_name: impl Into<String>, ) -> Self
Create a filter node (backward-compatible with old 3-arg constructor).
Sourcepub fn filter_with_id(
id: impl Into<String>,
filter_name: impl Into<String>,
) -> Self
pub fn filter_with_id( id: impl Into<String>, filter_name: impl Into<String>, ) -> Self
Create a filter node with explicit id and filter_name.
Sourcepub fn filter(filter_name: impl Into<String>) -> Self
pub fn filter(filter_name: impl Into<String>) -> Self
Create a filter node where id defaults to filter_name.
Sourcepub fn loop_node(id: impl Into<String>, max_iterations: Option<usize>) -> Self
pub fn loop_node(id: impl Into<String>, max_iterations: Option<usize>) -> Self
Create a loop node whose stop condition is its body’s terminal node.
Sourcepub fn loop_until(
id: impl Into<String>,
max_iterations: Option<usize>,
until: LoopCondition,
) -> Self
pub fn loop_until( id: impl Into<String>, max_iterations: Option<usize>, until: LoopCondition, ) -> Self
Create a loop node with an explicit stop condition.
Sourcepub fn step(id: impl Into<String>, step_name: impl Into<String>) -> Self
pub fn step(id: impl Into<String>, step_name: impl Into<String>) -> Self
Create an effectful step node.
Sourcepub fn branch(id: impl Into<String>) -> Self
pub fn branch(id: impl Into<String>) -> Self
Create a branch node whose arms are inferred from its control edges.
Sourcepub fn branch_over(
id: impl Into<String>,
arms: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn branch_over( id: impl Into<String>, arms: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Create a branch node declaring the labels its condition may produce.
The compiler then checks the edges against this list in both directions: a declared arm with no edge, or an edge labelling an arm that was never declared, is a compile error rather than a branch that silently never fires.
Sourcepub fn with_target(self, target: impl Into<String>) -> Self
pub fn with_target(self, target: impl Into<String>) -> Self
Set the execution target for this node.
Sourcepub fn filter_name(&self) -> Option<&str>
pub fn filter_name(&self) -> Option<&str>
Get the filter name if this is a Filter node.