Trait neuronika::Forward [−][src]
pub trait Forward {
fn forward(&self);
fn was_computed(&self) -> bool;
fn reset_computation(&self);
}
Expand description
Forward-propagation behavior.
This trait is implemented by all the internal forward components of Var
and VarDiff
.
The main method it provides is the .forward()
method that is used to propagate computations
from the leaf variables to the graph’s root.
The other two methods, namely .was_computed()
and .reset_computation()
, are used to perform
caching during the forward pass. Caching is critical to avoid recomputing paths and to achieve
good performance when a computational graph has more than one root, like the one, for instance,
of a recurrent neural network.
Required methods
Propagates the computations forwards.
It also defines the logic for the computation of the node.
fn was_computed(&self) -> bool
fn was_computed(&self) -> bool
Returns true
if the node was computed, false
otherwise.
fn reset_computation(&self)
fn reset_computation(&self)
Reset the node’s flag, making it computable again.