Skip to main content

ClikaRT::graph::Node

class

Header: ClikaRT/graph/node.h

One node of a compiled graph: an operator, or a graph input.

Member functions​

name()​

std::string name() const

The node's name, unique within its graph (an ONNX node name, a traced operator's generated name, a graph input's declared name).

Declared in ClikaRT/graph/node.h, line 132

kind()​

NodeKind kind() const

Declared in ClikaRT/graph/node.h, line 133

op_code()​

OpCode op_code() const

The operator. OpCode::Placeholder for an Input node, OpCode::Custom for a user-defined operator (see custom_name()).

Declared in ClikaRT/graph/node.h, line 136

custom_name()​

std::string custom_name() const

A user-defined operator's own name; empty unless op_code() is OpCode::Custom.

Declared in ClikaRT/graph/node.h, line 139

inputs()​

std::vector<Value> inputs() const

The values this node consumes, in input-port order; an omitted optional operand has no entry. A constant operand of a compiled ONNX graph (an initializer) is an input (Value::is_constant()) and also the operator's bound tensor, the same bytes read two ways; a traced module's weights are bound into the operator alone, see bound_tensors().

Declared in ClikaRT/graph/node.h, line 146

outputs()​

std::vector<Value> outputs() const

The values this node produces, one per output port in port order. An output that no operator and no graph output reads has no entry.

Declared in ClikaRT/graph/node.h, line 149

predecessors()​

std::vector<Node> predecessors() const

The nodes producing this node's inputs, in first-use order, each once. A constant or state operand has no producing node and contributes none.

Declared in ClikaRT/graph/node.h, line 152

successors()​

std::vector<Node> successors() const

The nodes consuming this node's outputs, in first-use order, each once.

Declared in ClikaRT/graph/node.h, line 154

attributes()​

std::vector<Attr> attributes() const

The operator's configuration, one entry per setting in the operator's own order. Tensors are not attributes: an operand arrives through inputs(), a bound weight through bound_tensors().

Declared in ClikaRT/graph/node.h, line 158

attribute()​

std::optional<Attr> attribute(std::string_view name) const

The attribute named name, or std::nullopt.

Declared in ClikaRT/graph/node.h, line 160

fused_activation()​

std::optional<ops::Activation> fused_activation() const

The activation the operator applies to its result in the same pass (a projection with a fused activation): Activation::Identity when the operator carries the setting but applies none, empty when the operator has no such setting.

Declared in ClikaRT/graph/node.h, line 165

bound_tensors()​

std::vector<BoundTensor> bound_tensors() const

The tensors bound into the operator itself, in the operator's own order, one entry per slot that holds a tensor: a traced module's weights. The names are the OPERATOR's slots, not the module's parameter names: an nn::Linear binds its [out, in] weight as its matmul's second operand, slot "b", and its bias as "bias". Each tensor is a shared handle to the bound bytes, no copy. A compiled ONNX initializer appears both as a constant input (Value::is_constant()) and as the operator's bound tensor; the two read the same bytes. Empty for an Input node and for an operator that binds nothing.

A weight the module has already packed into its kernel layout is released from the operator and is not reported: the pack runs at the module's first forward (or at load with nn::LoadOptions::pack_on_load), and again when a trace finalizes (the default TraceOptions::bake), so on a finalized graph the packed operators report no weight. A packed weight is read from its owning module: nn::Module::named_parameters() / state_dict() reconstruct it value-exact. To read a module's weights here, load it with nn::LoadOptions::weight_residency set to nn::WeightResidency::Borrowed (or PerCall) and trace with bake off.

Declared in ClikaRT/graph/node.h, line 186

Friends​

operator==​

friend bool operator==(const Node& a, const Node& b) noexcept

Two views of the same node compare equal.

Declared in ClikaRT/graph/node.h, line 189