4.1.6. Node¶
-
class
primitiv::Node¶ Pointer of a node in the computation graph.
Public Functions
-
bool
valid() const¶ Returns whether the node is valid or not.
- Return
- true or false w.r.t. the node is valid or not.
-
std::uint32_t
operator_id() const¶ Returns the operator ID.
- Return
- Operator ID.
-
std::uint32_t
value_id() const¶ Returns the value ID of the operator.
- Return
- Value ID.
-
float
to_float() const¶ Calculates the value of this node and returns a float.
- Return
- A calculated float value.
- Remark
- This function calls Graph::forward() internally. This function can be used only when the Node has a scalar and non-minibatched shape (i.e., shape() == Shape())
-
std::vector<float>
to_vector() const¶ Calculates the value of this node and returns a list of float.
- Return
- A list of calculated values.
- Remark
- This function calls Graph::forward() internally.
-
std::vector<std::uint32_t>
argmax(std::uint32_t dim) const¶ Returns argmax indices along an axis of this node.
- Return
- A list of integers that indicates positions of the maximum values.
- Parameters
dim: A specified axis.
-
std::vector<std::uint32_t>
argmin(std::uint32_t dim) const¶ Returns argmin indices along an axis of this node.
- Return
- A list of integers that indicates positions of the minimum values.
- Parameters
dim: A specified axis.
-
void
backward() const¶ Executes the backward operation from this node.
-
bool