pub struct IrGraph {
pub name: String,
pub nodes: Vec<IrNode>,
pub inputs: Vec<NodeId>,
pub outputs: Vec<IrOutput>,
pub params: Vec<IrParam>,
pub asserts: Vec<IrAssert>,
pub name_to_id: HashMap<String, NodeId>,
}Fields§
§name: StringGraph name (e.g., “Forward”).
nodes: Vec<IrNode>All nodes, indexed by NodeId.
inputs: Vec<NodeId>Input nodes (by NodeId).
outputs: Vec<IrOutput>Named outputs.
params: Vec<IrParam>Learnable parameters.
asserts: Vec<IrAssert>Assertions to verify.
name_to_id: HashMap<String, NodeId>Node lookup by name.
Implementations§
Source§impl IrGraph
impl IrGraph
Sourcepub fn add_node(
&mut self,
name: impl Into<String>,
op: OpKind,
inputs: Vec<NodeId>,
output_type: IrType,
) -> NodeId
pub fn add_node( &mut self, name: impl Into<String>, op: OpKind, inputs: Vec<NodeId>, output_type: IrType, ) -> NodeId
Add a node and return its NodeId.
Sourcepub fn add_output(&mut self, node_id: NodeId)
pub fn add_output(&mut self, node_id: NodeId)
Register a node as an output. Uses the node’s name as the output name.
Sourcepub fn add_output_named(&mut self, name: impl Into<String>, node_id: NodeId)
pub fn add_output_named(&mut self, name: impl Into<String>, node_id: NodeId)
Register a node as an output with a custom name.
Sourcepub fn node_mut(&mut self, id: NodeId) -> &mut IrNode
pub fn node_mut(&mut self, id: NodeId) -> &mut IrNode
Get a mutable reference to a node by its ID.
Sourcepub fn topo_order(&self) -> Vec<NodeId>
pub fn topo_order(&self) -> Vec<NodeId>
Return a topological ordering of node IDs for execution.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for IrGraph
impl RefUnwindSafe for IrGraph
impl Send for IrGraph
impl Sync for IrGraph
impl Unpin for IrGraph
impl UnwindSafe for IrGraph
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more