# qairt.api.converter

## qairt.api.converter.converter\_config

- *class* qairt.api.converter.converter\_config.ConverterConfig(*\*args: Any*, *\*\*kwargs: Any*)

    - Bases: `AISWBaseModel`

Pydantic class of parameters for model conversion.

- batch*: Optional[int]*  *= None*

    - The batch dimension override. This will take the first dimension of all inputs and treat it as a batch
dim, overriding it with the value provided here.

- create\_custom\_io*: bool*  *= False*

    - When set to True, automatically infers input\_tensor\_config and output\_tensor\_config from ONNX models.
Extracts tensor names, datatypes, shapes, and infers layouts.
User-provided configs take precedence if already specified.

Example

>>> converted_model = qairt.convert("model.onnx", create_custom_io=True)
    Copy to clipboard

- defer\_loading*: bool*  *= False*

    - Option to have the model not load weights. If False, the model will be loaded eagerly.

- define\_symbol*: Optional[List[Tuple[str, int]]]*  *= None*

    - Option to override specific input dimension symbols.

- dump\_json(*output\_path: Optional[Union[str, PathLike]] = None*, *indent: int = 2*) → str

    - Generate JSON file from ConverterConfig with auto-generated YAML IO config.

Auto-generates a temp YAML IO config file (if tensor configs exist) and populates
config.io\_config with the YAML path, then serializes to JSON.

- Parameters

    - - **output\_path** – Path to save JSON file. If None, creates a temp file.
- **indent** – JSON indentation spaces. Default is 2.

- Returns

    - Path to the generated JSON file

Example

>>> config = ConverterConfig(input_tensor_config=[...])
    >>> json_path = config.dump_json()
    >>> qairt.convert(model_path, io_config=config.io_config)
    Copy to clipboard

- enable\_framework\_trace*: bool*  *= False*

    - Use this option to enable converter to trace the o/p tensor change information.

- export\_format*: Literal['DLC\_DEFAULT', 'DLC\_STRIP\_QUANT']*  *= 'DLC\_DEFAULT'*

    - Specifies the export format for the model.
“DLC\_DEFAULT”:
- Produces a Float graph from a Float source graph.
- Produces a Quantized graph from a source graph using provided encodings.
“DLC\_STRIP\_QUANT”:
- Produces a Float graph by removing all quantization data from the source graph.

- float\_bias\_precision*: Literal[16, 32]*  *= 32*

    - Option to select the precision to use for float bias tensor.

- float\_precision*: Literal[32, 16]*  *= 32*

    - The floating point precision to use for the model. Note the floating point precision will be applied to
all tensors (including static tensors). Users should ensure that the precision is supported by each
operation according to QAIRT spec.

- input\_tensor\_config*: Optional[List[[InputTensorConfig](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-converter.html#qairt.api.converter.converter_config.InputTensorConfig)]]*  *= None*

    - A list of input tensor configurations containing the name, shape, datatype, layout, desired layout,
desired datatype, quantization parameters, and optional flag of the input tensors.

- io\_config*: Optional[Union[str, PathLike]]*  *= None*

    - The path to the custom I/O configuration file. This file defines the custom input and output tensors.
This file takes precedence over input\_tensor\_config and output\_tensor\_config if any of them are also specified.

- onnx\_simplification*: bool*  *= True*

    - Do not attempt to simplify the model automatically. This may prevent some models from converting when
sequences of unsupported static operations are present. Default is True.

- op\_package\_config*: Optional[List[str | os.PathLike]]*  *= None*

    - List of absolute paths to a Qnn Op Package XML configuration file that contains user defined custom
operations.

- op\_package\_lib*: Optional[List[str | os.PathLike]]*  *= None*

    - List of absolute paths to converter op package library compiled by the OpPackage generator.

- output\_tensor\_config*: Optional[List[[OutputTensorConfig](https://docs.qualcomm.com/doc/80-87189-2/topic/qairt-api-converter.html#qairt.api.converter.converter_config.OutputTensorConfig)]]*  *= None*

    - A list of output tensor configurations containing the name, layout, desired layout, desired datatype,
quantization parameters, and optional flag of the output tensors.

- preserve\_io\_datatype*: Optional[Union[str, List[str]]]*  *= None*

    - Set this option to maintain the source framework datatype for input and output tensors. This option
is particularly useful when sequences of unsupported static operations are present. To preserve datatype
for all input and output tensors, use preserve\_io\_datatype = “all”. For select input and output tensors,
use preserve\_io\_datatype = [“input1”, “output1”, …]

- serialize\_io\_config(*info*)

    - Serialize ConverterConfig to dictionary with optional YAML IO config auto-generation.

When context={‘auto\_generate\_io’: True}, generates a temp YAML file from tensor configs
and populates the io\_config field.

Example

>>> config_dict = config.model_dump(context={"auto_generate_io": True})
    >>> # config.io_config now contains path to auto-generated YAML
    Copy to clipboard

## qairt.api.converter.converter\_config.CalibrationConfig

- *class* qairt.api.converter.converter\_config.CalibrationConfig(*\*args: Any*, *\*\*kwargs: Any*)

    - Bases: `AISWBaseModel`

Configuration for calibration process.

- act\_calibration\_method*: str*  *= 'min-max'*

    - Calibration method to use for activations. Valid methods are “min-max”, “sqnr”, “entropy”, “mse”, “percentile”

- act\_precision*: Literal[8, 16]*  *= 8*

    - Integer precision value to use while quantizing activations

- batch\_size*: int*  *= 1*

    - The size of the batch to be used during calibration.
Default is 1.

- bias\_precision*: Literal[8, 32]*  *= 8*

    - Precision value to use while quantizing biases

- dataset*: Optional[Union[str, PathLike, List, torch.utils.data.DataLoader, torch.utils.data.Dataset]]*  *= None*

    - The dataset to be used for calibration.
It can be a string, a PathLike object, or a list of datasets.

- keep\_weights\_quantized*: bool*  *= False*

    - Enable wFxp\_actFP configurations according to the provided bitwidth for weights and activations.

- model\_config *= {'arbitrary\_types\_allowed': True, 'extra': 'allow', 'protected\_namespaces': (), 'validate\_assignment': True}*

    - 

- num\_of\_samples*: int*  *= 512*

    - The number of samples to be used for calibration.
Default is 512.

- param\_calibration\_method*: str*  *= 'min-max'*

    - Calibration method to use for parameters. Valid methods are “min-max”, “sqnr”, “entropy”, “mse”, “percentile”

- per\_channel\_quantization*: bool*  *= True*

    - Enable per channel quantization for convolution based op weights

- per\_row\_quantization*: bool*  *= False*

    - Enable per row quantization for Matmul and FullyConnected ops

- per\_row\_quantization\_bias*: bool*  *= False*

    - Enable per row quantization of bias for FullyConnected ops, when weights are per-row quantized

- weights\_precision*: Literal[4, 8, 16]*  *= 8*

    - Precision value to use while quantizing weights

## qairt.api.converter.converter\_config.InputTensorConfig

- *class* qairt.api.converter.converter\_config.InputTensorConfig

    - Bases: `TypedDict`

TypedDict of input tensor configuration. Any of the keys can be omitted, except name.

- datatype*: Union[str, dtype, torch.dtype]*

    - Data type of input tensor. Default is float32.

- desired\_datatype*: Optional[Union[str, dtype, torch.dtype]]*

    - Desired data type of each input tensor.

- desired\_layout*: Optional[str]*

    - Desired layout of each input tensor. Valid layouts include “channels\_first”, “channels\_last”, “NCDHW”, “NDHWC”,
“NCHW”, “NHWC”, “HWIO”, “OIHW”, “NFC”, “NCF”, “NTF”, “TNF”, “NF”, “NC”, “F”, “NONTRIVIAL”.

- layout*: Optional[str]*

    - Layout of each input tensor. Valid layouts include “channels\_first”, “channels\_last”, “NCDHW”, “NDHWC”,
“NCHW”, “NHWC”, “HWIO”, “OIHW”, “NFC”, “NCF”, “NTF”, “TNF”, “NF”, “NC”, “F”, “NONTRIVIAL”.
Default is None.

- name*: str*

    - Name of tensor. This is required.

- optional*: Optional[bool]*

    - Marks the tensor as optional, allowing it to be omitted when execution is triggered.

- quant\_param*: Optional[qti.aisw.tools.core.modules.converter.converter\_module.QuantParam]*

    - Scale and Offset. Default is None.

- Type

    - Quantization parameters for each input tensor. QuantParam field (optional) has two sub fields

- shape*: Union[Tuple[int, ...], List[Tuple[int, ...]], torch.Size]*

    - Shape of input tensor. Default is None.

## qairt.api.converter.converter\_config.OutputTensorConfig

- *class* qairt.api.converter.converter\_config.OutputTensorConfig

    - Bases: `TypedDict`

TypedDict of output tensor configuration. Any of the keys can be omitted, except name.

- desired\_datatype*: Optional[Union[str, dtype, torch.dtype]]*

    - Desired data type of each output tensor.

- desired\_layout*: Optional[str]*

    - Desired layout of each output tensor. Valid layouts include “NCDHW”, “NDHWC”,
“NCHW”, “NHWC”, “HWIO”, “OIHW”, “NFC”, “NCF”, “NTF”, “TNF”, “NF”, “NC”, “F”, “NONTRIVIAL”.

- layout*: Optional[str]*

    - Layout of each output tensor. Valid layouts include “NCDHW”, “NDHWC”,
“NCHW”, “NHWC”, “HWIO”, “OIHW”, “NFC”, “NCF”, “NTF”, “TNF”, “NF”, “NC”, “F”, “NONTRIVIAL”.
Default is None.

- name*: str*

    - Name of tensor. This is required.

- optional*: Optional[bool]*

    - Marks the tensor as optional. If set to true, the tensors will not be written by the backend.

- quant\_param*: Optional[qti.aisw.tools.core.modules.converter.converter\_module.QuantParam]*

    - Scale and Offset. Default is None.

- Type

    - Quantization parameters for each output tensor. QuantParam field (optional) has two sub fields

Note

For more details on input/output customization using YAML, see the
[QAIRT Converter](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/converters.html#input-output-customization-using-yaml).

Last Published: May 26, 2026

[Previous Topic
qairt.api.configs](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-api-configs.md) [Next Topic
qairt.api.executor](https://docs.qualcomm.com/bundle/publicresource/80-87189-2/topics/qairt-api-executor.md)