v2.0.0
Loading...
Searching...
No Matches
ml_onnx_model.h File Reference

ONNX Runtime backed MLLIB::MlModel implementation for loading and evaluating .onnx graphs. More...

#include "ml_global.h"
#include "ml_model.h"
#include <QString>
#include <memory>
#include <string>
#include <vector>
Include dependency graph for ml_onnx_model.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MLLIB::MlOnnxModel
 MlModel backend that runs .onnx graphs through ONNX Runtime with a cached CPU session. More...

Namespaces

namespace  MLLIB
 Tensors, model abstraction, ONNX Runtime inference and Python training drivers used across mne-cpp.

Detailed Description

ONNX Runtime backed MLLIB::MlModel implementation for loading and evaluating .onnx graphs.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.0
Date
April 2026

MLLIB::MlOnnxModel is the default inference backend in MLLIB: load any model exported to the ONNX format - from PyTorch, scikit-learn (via skl2onnx), TensorFlow, or hand-crafted - and predict on MLLIB::MlTensor inputs without any framework runtime other than ONNX Runtime itself. The class owns the Ort::Session, a reusable CPU Ort::MemoryInfo, and the cached input/output node names and shapes so per-call overhead stays minimal.

Each predict wraps the input tensor's row-major float buffer in an Ort::Value zero-copy, dispatches Session::Run, and copies the first output tensor into a fresh MLLIB::MlTensor; multi-IO graphs are supported by the cached name arrays but the public API intentionally exposes a single-in / single-out shape until a use case requires more. When mne-cpp is built without USE_ONNXRUNTIME the methods compile to stubs that throw std::runtime_error or log and return, so dependent code can be gated at runtime rather than via #ifdef chains.

Definition in file ml_onnx_model.h.