Skip to main content

ClikaRT::graph::CompileOptions

struct

Header: ClikaRT/graph/input_specs.h

How io::OnnxModel::compile builds the executable graph.

Shapes: with neither specs nor 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 is the easy road: example tensors whose shapes and dtypes matter and whose values do not; specs is the precise road. Both may combine (each input takes whichever covers it; specs wins).

Data members

specs

Per-input shape specification (the precise road).

Declared in ClikaRT/graph/input_specs.h, line 288

sample_inputs

NamedTensors sample_inputs

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

Declared in ClikaRT/graph/input_specs.h, line 291

optimize

bool optimize = true

Run the graph-optimization pipeline and finalize the operators' packed weight forms. Off = the raw as-parsed topology.

Declared in ClikaRT/graph/input_specs.h, line 294

specialize

bool specialize = false

Additionally COLLAPSE always-constant subgraphs (shape-arithmetic cones, masks, reshape templates fixed by the pinned shapes) into baked constants. Off by default: a collapsed graph computes those values no more; it serves exactly the pinned shapes. Explicit opt-in.

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

allow_permuting_inputs_channels_last

bool allow_permuting_inputs_channels_last = false

Omit the standard channels-first→channels-last conversion where a model input enters through one, and supply that input channels-last ([N, spatial..., C]) yourself, a caller whose data already lives channels-last (camera frames, HWC image buffers) skips a per-inference transpose. CHANGES the I/O contract for exactly those inputs; the compiled input shapes ALWAYS report the layout to supply, so read them rather than assuming. Inputs that enter through no such conversion are untouched. Off by default; requires optimize = true.

Declared in ClikaRT/graph/input_specs.h, line 308

allow_permuting_outputs_to_channels_last

bool allow_permuting_outputs_to_channels_last = false

The output-side peer: omit the standard channels-last→channels-first conversion where an output leaves through one, returning that output channels-last ([N, spatial..., C]) under its declared name. CHANGES the I/O contract for exactly those outputs; the compiled output shapes ALWAYS report the layout delivered. Outputs that leave through no such conversion are untouched. Off by default; requires optimize = true.

Declared in ClikaRT/graph/input_specs.h, line 316

weights

io::LoadPolicy weights

Weight residency: target device/stream and eviction stickiness.

Declared in ClikaRT/graph/input_specs.h, line 318