Class Node¶
Defined in File node.h
Inheritance Relationships¶
Base Type¶
public marian::Chainable< Tensor >
(Template Class Chainable)
Derived Types¶
public marian::ConstantNode
(Struct ConstantNode)public marian::NaryNodeOp
(Struct NaryNodeOp)public marian::ParamNode
(Struct ParamNode)
Class Documentation¶
-
class
Node
: public marian::Chainable<Tensor>¶ Main node class for computation graph, implements most common functions demanded by Chainable.
Each operation in a computation graph is a node.
Subclassed by marian::ConstantNode, marian::NaryNodeOp, marian::ParamNode
Public Functions
-
virtual
~Node
()¶
-
float
scalar
()¶
-
void
forward
()¶
-
void
backward
()¶
-
virtual bool
trainable
()¶
-
virtual void
setTrainable
(bool trainable)¶
-
virtual bool
memoize
()¶
-
virtual void
setMemoize
(bool memoize)¶
-
virtual void
setId
(size_t id)¶
-
virtual size_t
getId
()¶
-
virtual void
increaseEdges
(size_t edges = 1)¶
-
virtual void
decreaseEdges
(size_t edges = 1)¶
-
virtual size_t
edges
()¶
-
virtual Ptr<ExpressionGraph>
graph
()¶
-
virtual bool
marked_for_debug
()¶
-
void
allocate
()¶
-
void
free
()¶
-
virtual void
init
()¶
-
void
init_dependent
()¶ Initialization for backward step of top node in computation graph.
Allocates memory and sets gradient to 1 (df/df == 1).
-
void
set_zero_adjoint
()¶ Initialization for backward step of any non-top node in computation graph.
Allocates memory and sets gradient to 0 for further accumulation of gradients from all parents.
-
virtual Tensor &
val
()¶
-
virtual Tensor &
grad
()¶
-
void
record
(Ptr<AutoTunerRecorder> recorder, size_t recorderHash, bool stop)¶
-
virtual void
markCheckpoint
()¶
-
virtual bool
isCheckpoint
() const¶
Protected Attributes
-
size_t
id_
= {0}¶
-
size_t
edges_
= {0}¶
-
bool
trainable_
= {true}¶
-
bool
destroy_
= {true}¶
-
bool
memoize_
= {false}¶
-
Weak<ExpressionGraph>
graph_
¶
-
Tensor
val_
= {nullptr}¶
-
Tensor
adj_
= {nullptr}¶
-
bool
markedForDebug_
= {false}¶
-
bool
isCheckpoint_
= {false}¶
-
Ptr<AutoTunerRecorder>
recorder_
¶
-
size_t
recorderHash_
¶
-
bool
recorderStop_
¶
-
virtual