cg_constant {cgraph} | R Documentation |
Add a constant node to the active graph.
cg_constant(value, name = NULL)
value |
numeric vector or array, value of the node. |
name |
character scalar, name of the node (optional). In case argument |
cg_node object.
Constant nodes are ignored when differentiating a graph.
Ron Triepels
# Initialize a computational graph x <- cg_graph() # Add a constant with value 1 and name 'a' to the graph. a <- cg_constant(1, name = "a")