---
title: "ClikaRT::graph::CompileOptions"
sidebar_label: "CompileOptions"
description: "How io::OnnxModel::compile builds the graph. The compile returns the graph as built: optimize() runs the graph optimizer when wanted (its DefaultsOptions hold the specialization and channels-last choi…"
---

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

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

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

How [`io::OnnxModel::compile`](../io/OnnxModel.md#compile) builds the graph. The compile returns the graph as built: `optimize()` runs the graph optimizer when wanted (its [`DefaultsOptions`](./DefaultsOptions.md) hold the specialization and channels-last choices), and `finalize()` places the graph on the [`weights`](./CompileOptions.md#weights) device and readies it to run.

Shapes: with neither [`specs`](./CompileOptions.md#specs) nor [`sample_inputs`](./CompileOptions.md#sample_inputs), dynamic input dims stay dynamic; the graph binds real shapes at run time. Providing either pins the named dims to concrete values, which specializes the compiled graph to those shapes and unlocks shape-driven optimization; a dim shared by name across inputs (an ONNX `dim_param`) propagates, and detected KV-cache inputs are derived automatically, so speccing the genuine data inputs is enough. [`sample_inputs`](./CompileOptions.md#sample_inputs) is the easy road: example tensors whose shapes and dtypes matter and whose values do not; [`specs`](./CompileOptions.md#specs) is the precise road. Both may combine (each input takes whichever covers it; [`specs`](./CompileOptions.md#specs) wins).

## Data members

### specs {#specs}

<div class="api-signature">

[`spec::InputSpecs`](../spec/InputSpecs.md) **`specs`**

</div>

Per-input shape specification (the precise road).

<div class="api-declared">

Declared in `ClikaRT/graph/input_specs.h`, line 292

</div>

### sample\_inputs {#sample_inputs}

<div class="api-signature">

[`NamedTensors`](../NamedTensors.md) **`sample_inputs`**

</div>

Example input tensors, by input name; each contributes its shape as a fixed profile for that input (the easy road; values are never read).

<div class="api-declared">

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

</div>

### weights {#weights}

<div class="api-signature">

[`io::LoadPolicy`](../io/LoadPolicy.md) **`weights`**

</div>

Weight residency: target device/stream and eviction stickiness. The device is where [`ModelGraph::finalize()`](./ModelGraph.md#finalize) places the graph (`to()` changes it before then).

<div class="api-declared">

Declared in `ClikaRT/graph/input_specs.h`, line 299

</div>
