ClikaRT::graph::Value
class
Header: ClikaRT/graph/node.h
A tensor on a graph edge: an operator's output on one port, a graph input, or a constant (a weight bound into the graph). One value per (producer, port): the same tensor consumed by two operators is one value, and every view of it compares equal and hashes alike (std::hash<Value>), whichever node listed it. The view finds its value again by that key after an edit; once no value has it, the view answers empty and check() says so.
Member functions
check()
void check() const
Nothing when the graph still holds this value; Status::InvalidArgument naming the producer and port when it no longer does (the producer was removed or renamed, or reads of that port are gone) or when the graph itself no longer exists.
Declared in ClikaRT/graph/node.h, line 111
name()
std::string name() const
The name the graph declared for this tensor: a graph output's declared name, the same through every view of the value. Every other value is unnamed (empty): identify it by its producer and port, and read a graph input's name from its Input node.
Declared in ClikaRT/graph/node.h, line 116
spec()
spec::TensorSpec spec() const
The (name, dtype, dims) spec. A dim the graph left dynamic reads as spec::TensorSpec::kDynamicDim and keeps the model's name for it, when there is one, in dim_names.
Declared in ClikaRT/graph/node.h, line 120
is_constant()
bool is_constant() const
A constant: a weight or another tensor bound into the graph, with bytes fixed for the graph's lifetime. constant() reads them.
Declared in ClikaRT/graph/node.h, line 123
is_state()
bool is_state() const
A live state buffer the graph seeds and rewrites in place between runs (a key/value cache plane): bound like a constant, but its bytes change.
Declared in ClikaRT/graph/node.h, line 126
is_graph_input()
bool is_graph_input() const
A runtime input: the output of an Input node, bound by the caller at run.
Declared in ClikaRT/graph/node.h, line 129
is_graph_output()
bool is_graph_output() const
A graph output: one of the tensors run returns.
Declared in ClikaRT/graph/node.h, line 131
producer()
std::optional<Node> producer() const
The node that produces this value. Empty for a constant or a state buffer: no operator produces those.
Declared in ClikaRT/graph/node.h, line 134
producer_port()
int producer_port() const
The output port of producer() this value leaves on (0 when there is no producer).
Declared in ClikaRT/graph/node.h, line 137
constant()
Tensor constant() const
The constant's tensor: a shared handle to the bound bytes, no copy. Fails with Status::InvalidArgument when the value is not a constant.
Declared in ClikaRT/graph/node.h, line 141
uses()
std::vector<Edge> uses() const
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.
Declared in ClikaRT/graph/node.h, line 146
consumers()
std::vector<Node> consumers() const
The operators that read this value, each once, in the order of their reads; a constant's or a state buffer's readers too.
Declared in ClikaRT/graph/node.h, line 149
Friends
operator==
friend bool operator==(const Value& a, const Value& b) noexcept
Two views of the same value (the same graph, producer and output port) compare equal.
Declared in ClikaRT/graph/node.h, line 153