cg_constant: Add Constant

Description Usage Arguments Value Note Author(s) Examples

View source: R/node.R

Description

Add a constant to the active graph.

Usage

1
cg_constant(value, name = NULL)

Arguments

value

R object, value of the node.

name

character scalar, name of the node (optional). In case argument name is missing, the node is added to the graph under an automatically generated name.

Value

cg_node object.

Note

Constant nodes are ignored when differentiating a graph.

Author(s)

Ron Triepels

Examples

1
2
3
4
5
# Initialize a computational graph
graph <- cg_graph()

# Add a constant with value 1 and name 'a' to the graph.
a <- cg_constant(1, name = "a")

triepels/cgraph documentation built on April 24, 2020, 12:58 a.m.