---
title: "ClikaRT::graph::Node"
sidebar_label: "Node"
description: "One node of a compiled graph: an operator, or a graph input. The view finds its node again by name after an edit; once no node has that name (it was removed or renamed), the view answers empty and che…"
---

<!-- Generated by tools/doxygen2mdx from Doxygen XML. Do not edit. -->

<span class="api-kind api-kind--class">class</span>

**Header:** `ClikaRT/graph/node.h`

One node of a compiled graph: an operator, or a graph input. The view finds its node again by name after an edit; once no node has that name (it was removed or renamed), the view answers empty and [`check()`](./Node.md#check) says so.

## Member functions

### check() {#check}

<div class="api-signature">

`void` **`check`**() `const`

</div>

Nothing when the graph still holds a node of this name; [`Status::InvalidArgument`](../../index.md#Status) naming it when it no longer does, or when the graph itself no longer exists.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 247

</div>

### name() {#name}

<div class="api-signature">

`std::string` **`name`**() `const`

</div>

The node's name, unique within its graph: a graph input's declared name, or a name the runtime generates from the operator's type (a compiled ONNX model's own Transpose keeps its ONNX node name).

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 251

</div>

### kind() {#kind}

<div class="api-signature">

[`NodeKind`](./index.md#NodeKind) **`kind`**() `const`

</div>

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 252

</div>

### op\_code() {#op_code}

<div class="api-signature">

[`OpCode`](./index.md#OpCode) **`op_code`**() `const`

</div>

The operator. `OpCode::Placeholder` for an `Input` node, `OpCode::Custom` for a user-defined operator (see [`custom_name()`](./Node.md#custom_name)).

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 255

</div>

### custom\_name() {#custom_name}

<div class="api-signature">

`std::string` **`custom_name`**() `const`

</div>

A user-defined operator's own name; empty unless [`op_code()`](./Node.md#op_code) is `OpCode::Custom`.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 258

</div>

### inputs() {#inputs}

<div class="api-signature">

`std::vector<`[`Value`](./Value.md)`>` **`inputs`**() `const`

</div>

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()`](./Value.md#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()`](./Node.md#bound_tensors).

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 265

</div>

### outputs() {#outputs}

<div class="api-signature">

`std::vector<`[`Value`](./Value.md)`>` **`outputs`**() `const`

</div>

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.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 268

</div>

### input() {#input}

<div class="api-signature">

`std::optional<`[`Value`](./Value.md)`>` **`input`**(`int` `port`) `const`

</div>

The value on input port `port`, a constant or state operand included; empty when nothing feeds the port (an omitted optional operand, a port the node lacks, any port of an `Input` node).

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 272

</div>

### output() {#output}

<div class="api-signature">

`std::optional<`[`Value`](./Value.md)`>` **`output`**(`int` `port`) `const`

</div>

The value on output port `port`; empty when no operator and no graph output reads it, and for a port the node lacks.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 275

</div>

### in\_edges() {#in_edges}

<div class="api-signature">

`std::vector<`[`Edge`](./Edge.md)`>` **`in_edges`**() `const`

</div>

The edges entering this node in input-port order, one per port another node feeds (`Mul(x, x)` has two); a constant or state operand is an input but no edge.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 279

</div>

### out\_edges() {#out_edges}

<div class="api-signature">

`std::vector<`[`Edge`](./Edge.md)`>` **`out_edges`**() `const`

</div>

The edges leaving this node, one per read, in (output port, consumer name, consumer input port) order.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 282

</div>

### in\_degree() {#in_degree}

<div class="api-signature">

`std::size_t` **`in_degree`**() `const`

</div>

[`in_edges()`](./Node.md#in_edges)`.size()`, parallel edges counted.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 284

</div>

### out\_degree() {#out_degree}

<div class="api-signature">

`std::size_t` **`out_degree`**() `const`

</div>

[`out_edges()`](./Node.md#out_edges)`.size()`, parallel edges counted.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 286

</div>

### predecessors() {#predecessors}

<div class="api-signature">

`std::vector<Node>` **`predecessors`**() `const`

</div>

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.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 289

</div>

### successors() {#successors}

<div class="api-signature">

`std::vector<Node>` **`successors`**() `const`

</div>

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

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 291

</div>

### attributes() {#attributes}

<div class="api-signature">

`std::vector<`[`Attr`](./Attr.md)`>` **`attributes`**() `const`

</div>

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

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 295

</div>

### attribute() {#attribute}

<div class="api-signature">

`std::optional<`[`Attr`](./Attr.md)`>` **`attribute`**(`std::string_view` `name`) `const`

</div>

The attribute named [`name`](./Node.md#name), or `std::nullopt`.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 297

</div>

### fused\_activation() {#fused_activation}

<div class="api-signature">

`std::optional<`[`ops::Activation`](../ops/index.md#Activation)`>` **`fused_activation`**() `const`

</div>

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.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 302

</div>

### bound\_tensors() {#bound_tensors}

<div class="api-signature">

`std::vector<`[`BoundTensor`](./BoundTensor.md)`>` **`bound_tensors`**() `const`

</div>

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`](../nn/Linear.md) 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()`](./Value.md#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`](../nn/LoadOptions.md#pack_on_load)), and again when the traced graph is finalized ([`ModelGraph::finalize`](./ModelGraph.md#finalize)), so on a finalized graph the packed operators report no weight. A packed weight is read from its owning module: [`nn::Module::named_parameters()`](../nn/Module.md#named_parameters) / `state_dict()` reconstruct it value-exact. To read a module's weights here, load it with [`nn::LoadOptions::weight_residency`](../nn/LoadOptions.md#weight_residency) set to [`nn::WeightResidency::Borrowed`](../nn/index.md#WeightResidency) (or `PerCall`) and read the graph before `finalize()`.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 323

</div>

## Friends

### operator== {#operator-eq}

<div class="api-signature">

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

</div>

Two views of the same node (the same graph and name) compare equal.

<div class="api-declared">

Declared in `ClikaRT/graph/node.h`, line 326

</div>
