---
title: "ClikaRT::graph::OnnxExportWriter"
sidebar_label: "OnnxExportWriter"
description: "Writes one node's ONNX form, for the handler the export calls with it. It is valid for that call only: a copy kept past it refuses every call (FAILED_PRECONDITION, naming the node)."
---

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

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

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

Writes one node's ONNX form, for the handler the export calls with it. It is valid for that call only: a copy kept past it refuses every call (`FAILED_PRECONDITION`, naming the node).

## Member functions

### input() {#input}

<div class="api-signature">

`std::string` **`input`**(`int` `port`) `const`

</div>

The ONNX name of the node's input on `port`; empty for an optional input the node leaves out between two it wires. [`Status::InvalidArgument`](../../index.md#Status) for a port past its last wired input.

<div class="api-declared">

Declared in `ClikaRT/graph/onnx_export.h`, line 41

</div>

### add\_initializer() {#add_initializer}

<div class="api-signature">

`std::string` **`add_initializer`**(`const` [`Tensor`](../Tensor.md)`&` `value`)

</div>

Write `value`'s bytes as a model constant; returns its ONNX name.

<div class="api-declared">

Declared in `ClikaRT/graph/onnx_export.h`, line 45

</div>

### add\_node() {#add_node}

<div class="api-signature">

`std::vector<std::string>` **`add_node`**(<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::string_view` `op_type`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`const std::vector<std::string>&` `inputs`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`int` `num_outputs`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`const std::vector<`[`io::OnnxAttr`](../io/OnnxAttr.md)`>&` `attrs` `=` `{}`,<br />
&nbsp;&nbsp;&nbsp;&nbsp;`std::string_view` `domain` `=` `{}`<br />
)

</div>

Append an ONNX node, as [`io::OnnxModel::add_node`](../io/OnnxModel.md#add_node) does: `inputs` name the operator's positional slots (an empty name leaves an optional input out), and the names of its `num_outputs` outputs return in order. `domain` empty is the standard `ai.onnx` domain; a node under a domain the model does not import is refused with [`Status::InvalidArgument`](../../index.md#Status).

<div class="api-declared">

Declared in `ClikaRT/graph/onnx_export.h`, line 58

</div>

### opset\_version() {#opset_version}

<div class="api-signature">

`std::int64_t` **`opset_version`**() `const`

</div>

The `ai.onnx` opset the model imports.

<div class="api-declared">

Declared in `ClikaRT/graph/onnx_export.h`, line 65

</div>
