pub struct FusionGraph { /* private fields */ }Expand description
An append-only builder for an operation DAG.
Implementations§
Source§impl FusionGraph
impl FusionGraph
Sourcepub fn add_op(
&mut self,
kind: OpKind,
inputs: Vec<usize>,
output_shape: Vec<usize>,
dtype_bytes: usize,
) -> usize
pub fn add_op( &mut self, kind: OpKind, inputs: Vec<usize>, output_shape: Vec<usize>, dtype_bytes: usize, ) -> usize
Appends an op and returns its freshly assigned id.
inputs must reference the ids of previously added ops (an empty list
denotes a source/leaf). Validity and acyclicity are checked by
FusionGraph::validate, not here, so a forward reference can be built
and later rejected.
Sourcepub fn validate(&self) -> Result<(), GpuOptimError>
pub fn validate(&self) -> Result<(), GpuOptimError>
Validates the graph: every input must reference an existing op, no op may
reference itself, dtype_bytes must be non-zero, byte counts must not
overflow, and the graph must be acyclic.
Returns GpuOptimError::InvalidState for a dangling input, a
self-reference, or a cycle.
Trait Implementations§
Source§impl Clone for FusionGraph
impl Clone for FusionGraph
Source§fn clone(&self) -> FusionGraph
fn clone(&self) -> FusionGraph
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 FusionGraph
impl Debug for FusionGraph
Source§impl Default for FusionGraph
impl Default for FusionGraph
Source§fn default() -> FusionGraph
fn default() -> FusionGraph
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for FusionGraph
impl RefUnwindSafe for FusionGraph
impl Send for FusionGraph
impl Sync for FusionGraph
impl Unpin for FusionGraph
impl UnsafeUnpin for FusionGraph
impl UnwindSafe for FusionGraph
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
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,
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