Skip to main content

Python class

Value

Value

class max.graph.Value(value: Value | Value | TensorValue | Weight | Shape | Dim | int | float | integer | floating | ndarray)

Represents a symbolic value within a Graph.

A Value can represent the output of a node, the arguments of a Graph (as seen from within its body), and more generally any symbolic value available within the Graph. Other nodes receive Value values as inputs to form a computation graph.

A Value may also refer to an existing input or output of a node, and you can change them, such as by swapping a new Value.

Conceptually, think of a Value as an edge in the dataflow graph, with the other end being the user of that value.

Similar to a regular variable, a Value has a data type.

tensor

property tensor*: TensorValue*

Returns the Value as a TensorValue.

Raise an exception if the Value is not a TensorValue.