Skip to main content

CompileOptions

The knobs of compiling a loaded model file (OnnxModel.compile): the input shape pins and the weight residency. The compile returns the graph as built; ModelGraph.optimize() takes the specialization and channels-last choices (DefaultsOptions).

place (property)​

The Device or Stream the weights live on and finalize() places the graph on, or None (the CPU).

sample_inputs (property)​

Example inputs by name; each pins its input's shape as a fixed profile.

specs (property)​

The input shape pins by name, each as a dict with min / opt / max shapes.

sticky (property)​

Keep the weights' lineage on disk (evictable, re-readable derived tensors).

__init__​

__init____init__(self, *, specs: object | None = None, sample_inputs: object | None = None, place: object | None = None, sticky: bool = False) -> None

init(self, *, specs: object | None = None, sample_inputs: object | None = None, place: object | None = None, sticky: bool = False) -> None

CompileOptions(*, specs=None, sample_inputs=None, place=None, sticky=False)

specs pins input shapes by name: a shape (sequence of ints), a (min, opt, max) triple of shapes, or a dict with min / opt / max. sample_inputs pins them from example tensors by name (values are never read). place is a Device, a device string or a Stream the weights live on and finalize() places the graph on; None keeps them on the CPU.