Skip to main content

GradEdge

Struct GradEdge 

Source
pub struct GradEdge<Op: GraphOp> {
    pub node: Option<Arc<GradNode<Op>>>,
    pub key: GlobalValKey<Op>,
    pub requires_grad: bool,
}
Expand description

Edge from a grad node to one of its primal inputs.

node points to the parent operation that produced the input. None denotes a leaf eager value. key is the cotangent accumulation target for that input.

§Examples

let edge = tidu::GradEdge::new(parent_node, input_key, requires_grad);

Fields§

§node: Option<Arc<GradNode<Op>>>

Parent grad node. None denotes a leaf input.

§key: GlobalValKey<Op>

Gradient accumulation target for this input.

§requires_grad: bool

Whether the input participates in gradient propagation.

Implementations§

Source§

impl<Op: GraphOp> GradEdge<Op>

Source

pub fn new( node: Option<Arc<GradNode<Op>>>, key: GlobalValKey<Op>, requires_grad: bool, ) -> Self

Create an eager backward edge.

§Examples
let edge = tidu::GradEdge::new(parent_node, input_key, true);

Auto Trait Implementations§

§

impl<Op> Freeze for GradEdge<Op>
where <Op as GraphOp>::InputKey: Freeze, Op: Freeze,

§

impl<Op> RefUnwindSafe for GradEdge<Op>
where <Op as GraphOp>::InputKey: RefUnwindSafe, Op: RefUnwindSafe, <Op as GraphOp>::Operand: RefUnwindSafe,

§

impl<Op> Send for GradEdge<Op>

§

impl<Op> Sync for GradEdge<Op>

§

impl<Op> Unpin for GradEdge<Op>
where <Op as GraphOp>::InputKey: Unpin, Op: Unpin,

§

impl<Op> UnsafeUnpin for GradEdge<Op>
where <Op as GraphOp>::InputKey: UnsafeUnpin, Op: UnsafeUnpin,

§

impl<Op> UnwindSafe for GradEdge<Op>
where <Op as GraphOp>::InputKey: UnwindSafe + RefUnwindSafe, Op: UnwindSafe + RefUnwindSafe, <Op as GraphOp>::Operand: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.