pub struct ComputationGraph<T: TensorElement> { /* private fields */ }Expand description
Computation graph
Implementations§
Source§impl<T: TensorElement + Copy> ComputationGraph<T>
impl<T: TensorElement + Copy> ComputationGraph<T>
Sourcepub fn binary_op(
&mut self,
op: GraphOp,
left: NodeId,
right: NodeId,
device: DeviceType,
) -> NodeId
pub fn binary_op( &mut self, op: GraphOp, left: NodeId, right: NodeId, device: DeviceType, ) -> NodeId
Add a binary operation node
Sourcepub fn unary_op(
&mut self,
op: GraphOp,
input: NodeId,
device: DeviceType,
) -> NodeId
pub fn unary_op( &mut self, op: GraphOp, input: NodeId, device: DeviceType, ) -> NodeId
Add a unary operation node
Sourcepub fn mark_output(&mut self, node: NodeId)
pub fn mark_output(&mut self, node: NodeId)
Mark a node as an output
Sourcepub fn num_outputs(&self) -> usize
pub fn num_outputs(&self) -> usize
Get the number of output nodes
Sourcepub fn topological_sort(&self) -> Result<Vec<NodeId>>
pub fn topological_sort(&self) -> Result<Vec<NodeId>>
Perform topological sort of the graph
Trait Implementations§
Source§impl<T: TensorElement + Copy> Default for ComputationGraph<T>
impl<T: TensorElement + Copy> Default for ComputationGraph<T>
Auto Trait Implementations§
impl<T> Freeze for ComputationGraph<T>
impl<T> RefUnwindSafe for ComputationGraph<T>where
T: RefUnwindSafe,
impl<T> Send for ComputationGraph<T>
impl<T> Sync for ComputationGraph<T>
impl<T> Unpin for ComputationGraph<T>
impl<T> UnsafeUnpin for ComputationGraph<T>
impl<T> UnwindSafe for ComputationGraph<T>where
T: RefUnwindSafe,
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> 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