pub struct ExpressionGraph { /* private fields */ }Expand description
Expression graph representing a computational graph of tensor operations
Implementations§
Source§impl ExpressionGraph
impl ExpressionGraph
Sourcepub fn add_node(&mut self, operation: OperationType) -> NodeId
pub fn add_node(&mut self, operation: OperationType) -> NodeId
Add a new node to the graph
Sourcepub fn add_edge(&mut self, from: NodeId, to: NodeId) -> Result<()>
pub fn add_edge(&mut self, from: NodeId, to: NodeId) -> Result<()>
Add an edge between two nodes
Sourcepub fn get_node(&self, id: NodeId) -> Option<&ExpressionNode>
pub fn get_node(&self, id: NodeId) -> Option<&ExpressionNode>
Get a node by ID
Sourcepub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut ExpressionNode>
pub fn get_node_mut(&mut self, id: NodeId) -> Option<&mut ExpressionNode>
Get a mutable node by ID
Sourcepub fn nodes(&self) -> &HashMap<NodeId, ExpressionNode>
pub fn nodes(&self) -> &HashMap<NodeId, ExpressionNode>
Get all nodes in the graph
Sourcepub fn topological_sort(&self) -> Result<Vec<NodeId>>
pub fn topological_sort(&self) -> Result<Vec<NodeId>>
Perform topological sort of the graph
Sourcepub fn detect_fusable_chains(&self) -> Vec<Vec<NodeId>>
pub fn detect_fusable_chains(&self) -> Vec<Vec<NodeId>>
Detect fusable operation chains
Sourcepub fn calculate_memory_usage(&self) -> usize
pub fn calculate_memory_usage(&self) -> usize
Calculate memory usage for the entire graph
Sourcepub fn calculate_compute_cost(&self) -> f32
pub fn calculate_compute_cost(&self) -> f32
Calculate total computation cost
Sourcepub fn get_leaf_nodes(&self) -> Vec<NodeId>
pub fn get_leaf_nodes(&self) -> Vec<NodeId>
Get all leaf nodes (nodes with no inputs)
Sourcepub fn verify_integrity(&self) -> Result<()>
pub fn verify_integrity(&self) -> Result<()>
Verify graph integrity
Trait Implementations§
Source§impl Clone for ExpressionGraph
impl Clone for ExpressionGraph
Source§fn clone(&self) -> ExpressionGraph
fn clone(&self) -> ExpressionGraph
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExpressionGraph
impl Debug for ExpressionGraph
Auto Trait Implementations§
impl Freeze for ExpressionGraph
impl RefUnwindSafe for ExpressionGraph
impl Send for ExpressionGraph
impl Sync for ExpressionGraph
impl Unpin for ExpressionGraph
impl UnwindSafe for ExpressionGraph
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