Skip to contents

value R6 class

value R6 class

Details

Represents a node in the computational graph with automatic differentiation. Each value object holds data, gradient, a backward function, previous nodes, and an operation name.

Public fields

data

Numeric value of the object

grad

Gradient value, initially set to 0

backward_fn

A function that performs the backward pass (gradient computation)

prev

A list of previous nodes in the computational graph

op

A character string representing the operation associated with the node

Methods

Public methods


Method new()

Initializes a new value object with the given data, list of children, and operation name.

Usage

value$new(data, children = list(), op = "")

Arguments

data

Numeric value of the object

children

List of previous nodes in the computational graph (default: empty list)

op

A character string representing the operation associated with the node (default: empty string)


Method clone()

The objects of this class are cloneable with this method.

Usage

value$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.