---
title: "ClikaRT::graph::OnnxExportOptions"
sidebar_label: "OnnxExportOptions"
description: "How ModelGraph::export_onnx and io::OnnxModel::from_graph write a graph as an ONNX model."
---

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

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

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

How [`ModelGraph::export_onnx`](./ModelGraph.md#export_onnx) and [`io::OnnxModel::from_graph`](../io/OnnxModel.md#from_graph) write a graph as an ONNX model.

## Data members

### opset\_version {#opset_version}

<div class="api-signature">

`std::int64_t` **`opset_version`** `= 0`

</div>

The `ai.onnx` opset the model imports; 0 or less takes the library's default. An operator whose ONNX form needs a newer opset is written as a composition of older operators, or refused, naming the opset.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 104

</div>

### contrib\_ops {#contrib_ops}

<div class="api-signature">

`bool` **`contrib_ops`** `= true`

</div>

Whether the model may use the `com.microsoft` operators (for example GroupQueryAttention or MatMulNBits). The domain is imported only when an operator uses it.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 108

</div>

### optimize {#optimize}

<div class="api-signature">

`bool` **`optimize`** `= true`

</div>

Simplify the written model before it is returned: pairs of transposes that undo each other compose, and nodes no output reads are dropped.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 111

</div>

### save\_as\_external\_data {#save_as_external_data}

<div class="api-signature">

`std::optional<bool>` **`save_as_external_data`**

</div>

Where the weights go when the model is saved: unset writes them to a `<stem>_data` file beside the model once they pass 2 GiB, `true` always does, and `false` never does.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 115

</div>

### producer\_name {#producer_name}

<div class="api-signature">

`std::string` **`producer_name`**

</div>

The producer name the model records; empty takes the library's.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 117

</div>

### handlers {#handlers}

<div class="api-signature">

`std::vector<`[`OnnxExportHandler`](./OnnxExportHandler.md)`>` **`handlers`**

</div>

Handlers that write chosen operators your way, in this export only ([`OnnxExportHandler`](./OnnxExportHandler.md), [onnx\_export.h](./index.md#onnx_export-h)). The list is checked before any node is written: an operator named twice, an empty handler, or one for [`OpCode::Unknown`](./index.md#OpCode) or `OpCode::Custom` refuses with InvalidArgument.

<div class="api-declared">

Declared in `ClikaRT/graph/model_graph.h`, line 122

</div>
