Trait wyrm::Node
[−]
[src]
pub trait Node: Debug + 'static { type Value; type InputGradient; fn forward(&self); fn backward(&self, _: &Ref<Self::InputGradient>); fn value(&self) -> Bor<Self::Value>; fn needs_gradient(&self) -> bool; fn zero_gradient(&self); }
Trait representing a computation node. Structs implementing this trait can be used as elements of the computation graph.
Associated Types
type Value
Type of the node's value.
type InputGradient
Type of the input gradient the node receives during backpropagation.
Required Methods
fn forward(&self)
Perform the forward step. Should recursively call the forward methods of its ancestors.
fn backward(&self, _: &Ref<Self::InputGradient>)
Perform the backward step. Should recursively call the backward methods of its ancestors.
fn value(&self) -> Bor<Self::Value>
Return the value of the node.
fn needs_gradient(&self) -> bool
If the node needs to be used in the backward step.
fn zero_gradient(&self)
Implementations on Foreign Types
impl Node for Rc<Node<Value = Arr, InputGradient = Arr>>
[src]
type Value = Arr
type InputGradient = Arr
fn forward(&self)
[src]
fn backward(&self, gradient: &Ref<Self::InputGradient>)
[src]
fn value(&self) -> Bor<Self::Value>
[src]
fn needs_gradient(&self) -> bool
[src]
fn zero_gradient(&self)
[src]
Implementors
impl Node for InputNode type Value = Arr; type InputGradient = Arr;
impl Node for ParameterNode type Value = Arr; type InputGradient = Arr;
impl Node for IndexInputNode type Value = SmallVec<[usize; 4]>; type InputGradient = Arr;
impl<LHS> Node for SparseCategoricalCrossentropyNode<LHS> where
LHS: Node<Value = Arr, InputGradient = Arr>, type Value = Arr; type InputGradient = Arr;