pub struct ComputationGraph {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
pub metadata: HashMap<String, String>,
}Expand description
Simplified computation graph representation for optimization
Fields§
§nodes: Vec<GraphNode>Graph nodes (operations)
edges: Vec<GraphEdge>Graph edges (data dependencies)
metadata: HashMap<String, String>Graph metadata
Implementations§
Source§impl ComputationGraph
impl ComputationGraph
Sourcepub fn get_node_mut(&mut self, id: usize) -> Option<&mut GraphNode>
pub fn get_node_mut(&mut self, id: usize) -> Option<&mut GraphNode>
Get mutable node by ID
Sourcepub fn get_node_edges(&self, node_id: usize) -> Vec<&GraphEdge>
pub fn get_node_edges(&self, node_id: usize) -> Vec<&GraphEdge>
Get all edges connected to a node
Sourcepub fn validate(&self) -> Result<(), TrustformersError>
pub fn validate(&self) -> Result<(), TrustformersError>
Validate the graph structure
Sourcepub fn total_compute_cost(&self) -> f64
pub fn total_compute_cost(&self) -> f64
Calculate total estimated compute cost
Sourcepub fn total_memory_cost(&self) -> f64
pub fn total_memory_cost(&self) -> f64
Calculate total estimated memory cost
Trait Implementations§
Source§impl Clone for ComputationGraph
impl Clone for ComputationGraph
Source§fn clone(&self) -> ComputationGraph
fn clone(&self) -> ComputationGraph
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 ComputationGraph
impl Debug for ComputationGraph
Source§impl Default for ComputationGraph
impl Default for ComputationGraph
Source§impl<'de> Deserialize<'de> for ComputationGraph
impl<'de> Deserialize<'de> for ComputationGraph
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ComputationGraph
impl RefUnwindSafe for ComputationGraph
impl Send for ComputationGraph
impl Sync for ComputationGraph
impl Unpin for ComputationGraph
impl UnsafeUnpin for ComputationGraph
impl UnwindSafe for ComputationGraph
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> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
impl<T> ConfigSerializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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