A directed edge in the backward computation graph.
An Edge connects a producer node to a specific input slot
(input_nr) of a consumer node. The owning shared_ptr keeps the
consumer alive while at least one producer references it, forming the
ownership chain that mirrors the forward computation. input_nr is
the positional index into the consumer's Node::apply output
vector where the arriving gradient must land.
See Also
Node — consumes edges as next_edges_ during backward.
Attributes
nodestd::shared_ptr<Node>The consumer node that should receive a gradient along this edge.
input_nrstd::uint32_tPositional input index on
node that this edge targets. The engine writes the produced gradient into apply's output at this slot.Notes
An invalid edge (node == nullptr) marks a structural hole — for
example an input that does not require grad — and is skipped by the
engine without raising.