Skip to main content

Value

A tensor between two nodes of a graph (or a graph input, output or constant): its name, its slot (spec()), what produces it, what reads it, and its role flags. Two views of the same value (the same producer and output port) compare equal. Holding a Value keeps the graph alive. After an edit the view finds its value again by its producer and port; once no value has them, or a merge, a split or an extract consumes the graph, check() and every accessor raise InvalidArgumentError naming them, while ==, hash and repr keep working.

name (property)​

The tensor's name.

__init__​

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

check​

checkcheck(self) -> None

check(self) -> None

check() -> None

None while the graph holds this value; raises InvalidArgumentError naming its producer and port once it does not (the producer was removed or renamed, the reads of that port are gone, or a merge, a split or an extract consumed the graph).

constant​

constantconstant(self) -> clika_runtime._core.Tensor

constant(self) -> clika_runtime._core.Tensor

constant() -> Tensor

The bound tensor of a constant value; raises for a value that is not a constant.

consumers​

consumersconsumers(self) -> list

consumers(self) -> list

consumers() -> list[Node]

The operators that read this value, each once, in the order of their reads; a constant's or a state buffer's readers too.

is_constant​

is_constantis_constant(self) -> bool

is_constant(self) -> bool

is_constant() -> bool

True for a bound constant (a weight, a baked value).

is_graph_input​

is_graph_inputis_graph_input(self) -> bool

is_graph_input(self) -> bool

is_graph_input() -> bool

True when a run's input binds here.

is_graph_output​

is_graph_outputis_graph_output(self) -> bool

is_graph_output(self) -> bool

is_graph_output() -> bool

True when a run returns this value.

is_state​

is_stateis_state(self) -> bool

is_state(self) -> bool

is_state() -> bool

True for a state buffer the graph updates across runs.

producer​

producerproducer(self) -> object

producer(self) -> object

producer() -> Node | None

The node computing this value (a graph input's Input node); None for a constant or a state buffer.

producer_port​

producer_portproducer_port(self) -> int

producer_port(self) -> int

producer_port() -> int

Which output of the producer this value is.

spec​

specspec(self) -> clika_runtime._core.TensorSpec

spec(self) -> clika_runtime._core.TensorSpec

spec() -> TensorSpec

The slot: name, dtype and dims (a symbolic dim is -1 and keeps the model's label in dim_names).

uses​

usesuses(self) -> list

uses(self) -> list

uses() -> list[Edge]

The edges carrying this value to its readers, one per read, in (consumer name, consumer input port) order; returning the value from the graph is no read. Edges join nodes, so the list of a constant or a state buffer is empty: consumers() and Node.input(port) reach its reads.