Struct GraphIr
pub struct GraphIr {
pub operations: Vec<OperationIr>,
pub inputs: Vec<TensorId>,
pub outputs: Vec<TensorId>,
}Expand description
An ordered operation graph with an explicit tensor boundary.
GraphIr::new infers the dependency boundary from the operations. Producers that expose a
narrower logical boundary, such as graph capture, may provide explicit inputs and outputs
after validating them against GraphIr::classify.
Fields§
§operations: Vec<OperationIr>Operations in execution order.
inputs: Vec<TensorId>Ordered tensor IDs exposed as graph inputs.
outputs: Vec<TensorId>Ordered tensor IDs exposed as graph outputs.
Implementations§
§impl GraphIr
impl GraphIr
pub fn new(operations: Vec<OperationIr>) -> GraphIr
pub fn new(operations: Vec<OperationIr>) -> GraphIr
Normalize an operation sequence and classify its tensor boundary in first-use order.
Inputs are tensors that aren’t produced by a compute operation: external data and results
from an earlier graph, including outputs of OperationIr::Init. Initializer handles are
registered out of band, so they remain graph inputs even though an initialization operation
produces them.
Outputs are tensors produced by compute operations that survive the graph. Tensors consumed
in place (ReadWrite) or explicitly dropped within the graph are excluded.
Intermediate tensors that are produced and then consumed in place or explicitly dropped appear in neither boundary. Input and output identifiers retain their first-use and production order, respectively, making construction deterministic.
pub fn classify(operations: &[OperationIr]) -> GraphBoundary
pub fn classify(operations: &[OperationIr]) -> GraphBoundary
Classify the dependency boundary of an operation sequence without cloning it.
This applies the same rules as GraphIr::new and is useful to validate an explicitly
declared logical boundary or to estimate graph binding costs.
Trait Implementations§
§impl<'de> Deserialize<'de> for GraphIr
impl<'de> Deserialize<'de> for GraphIr
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<GraphIr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<GraphIr, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl From<Vec<OperationIr>> for GraphIr
impl From<Vec<OperationIr>> for GraphIr
§fn from(operations: Vec<OperationIr>) -> GraphIr
fn from(operations: Vec<OperationIr>) -> GraphIr
§impl Serialize for GraphIr
impl Serialize for GraphIr
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for GraphIr
Auto Trait Implementations§
impl Freeze for GraphIr
impl RefUnwindSafe for GraphIr
impl Send for GraphIr
impl Sync for GraphIr
impl Unpin for GraphIr
impl UnsafeUnpin for GraphIr
impl UnwindSafe for GraphIr
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<K, Q> Comparable<Q> for K
impl<K, Q> Comparable<Q> for K
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<K, Q> Equivalent<Q> for K
impl<K, Q> Equivalent<Q> for K
§fn equivalent(&self, key: &Q) -> bool
fn equivalent(&self, key: &Q) -> bool
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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