# onnx_qnn

Python API: `depthai_nodes.runtime.onnx_qnn`

Create ONNX Runtime sessions on the OAK4 Hexagon DSP.

## Functions

| Name | Description |
| --- | --- |
| [`onnx_qnn_session`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/runtime/onnx_qnn.md#onnx_qnn-Functions-onnx_qnn_session) | Create an ONNX Runtime session running on the OAK4 DSP (HTP). |

### function `onnx_qnn_session`

```python
def onnx_qnn_session(
    model_path,
    *,
    fp16=True,
    cache_context=True,
    performance_mode='burst',
    fallback_to_cpu=True,
    runtime_fallback='ort',
    device_wait_s=60,
    ep_options=None,
    session_options=None,
    verbose=False,
)
```

Create an ONNX Runtime session running on the OAK4 DSP (HTP).

This helper is intended for the `onnxruntime` variant of `oakapp-base`. That image provides the FastRPC setup, QNN plugin, and
required device nodes.

Args

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `model_path` |  | path to a .onnx model. Inputs must have static shapes. | required |
| `fp16` |  | run fp32 graphs in fp16 on the HTP (no-op for QDQ int8 models). | `True` |
| `cache_context` |  | cache the compiled QNN graph (EPContext) next to the model so subsequent session creations skip HTP graph compilation. | `True` |
| `performance_mode` |  | QNN HTP performance mode (for example, `burst`). | `'burst'` |
| `fallback_to_cpu` |  | if False, raise when the DSP is unavailable during session creation or any node cannot be placed on it. If True, return a CPU session when no QNN device is available. | `True` |
| `runtime_fallback` |  | behavior after a QNN execution error. `"ort"` keeps ONNX Runtime's automatic fallback behavior; `"raise"` disables it so the caller can handle the error explicitly. | `'ort'` |
| `device_wait_s` |  | seconds to wait for a QNN device to appear during startup. Set to 0 to check once. | `60` |
| `ep_options` |  | extra QNN EP provider options (dict), merged last. | `None` |
| `session_options` |  | pre-configured ort.SessionOptions to extend. | `None` |
| `verbose` |  | enable verbose ORT logging. | `False` |

Returns

| Type | Description |
| --- | --- |
|  | onnxruntime.InferenceSession |

## Module Attributes

| Name | Description |
| --- | --- |
| [`logger`](https://docs.luxonis.com/software-v3/ai-inference/inference/depthai-nodes/depthai-nodes-api-reference/runtime/onnx_qnn.md#onnx_qnn-Module-Attributes-logger) |  |

### variable `logger`

```python
logger = get_logger(__name__)
```
