pub struct GraphNode {
pub id: NodeId,
pub value: Tensor,
pub gradient: Option<Tensor>,
pub operation: Option<OperationType>,
pub parents: Vec<NodeId>,
pub children: Vec<NodeId>,
pub requires_grad: bool,
pub is_leaf: bool,
pub name: Option<String>,
pub shape: Vec<usize>,
}Expand description
Node in the computation graph
Fields§
§id: NodeIdUnique identifier for this node
value: TensorThe tensor value at this node
gradient: Option<Tensor>Gradient accumulated at this node
operation: Option<OperationType>Operation that produced this node
parents: Vec<NodeId>Parent nodes (inputs to the operation)
children: Vec<NodeId>Child nodes (nodes that use this as input)
requires_grad: boolWhether this node requires gradients
is_leaf: boolWhether this node is a leaf (variable)
name: Option<String>Name for debugging
shape: Vec<usize>Shape information for optimization
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GraphNode
impl RefUnwindSafe for GraphNode
impl Send for GraphNode
impl Sync for GraphNode
impl Unpin for GraphNode
impl UnsafeUnpin for GraphNode
impl UnwindSafe for GraphNode
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> 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