v2.0.0
Loading...
Searching...
No Matches
MLLIB::MlOnnxModel Class Reference

ONNX Runtime backed model. More...

#include <ml_onnx_model.h>

Public Member Functions

 MlOnnxModel ()
 ~MlOnnxModel () override
MlTensor predict (const MlTensor &input) const override
bool save (const QString &path) const override
bool load (const QString &path) override
QString modelType () const override
MlTaskType taskType () const override
bool isLoaded () const
Public Member Functions inherited from MLLIB::MlModel
virtual ~MlModel ()=default

Additional Inherited Members

Public Types inherited from MLLIB::MlModel
typedef QSharedPointer< MlModelSPtr

Detailed Description

ONNX Runtime backed model.

When built without USE_ONNXRUNTIME all methods throw std::runtime_error.

Definition at line 79 of file ml_onnx_model.h.

Inheritance diagram for MLLIB::MlOnnxModel:
Inheritance graph

Constructor & Destructor Documentation

◆ MlOnnxModel()

MlOnnxModel::MlOnnxModel ( )

Default constructor.

Definition at line 80 of file ml_onnx_model.cpp.

◆ ~MlOnnxModel()

MlOnnxModel::~MlOnnxModel ( )
override

Destructor.

Definition at line 86 of file ml_onnx_model.cpp.

Member Function Documentation

◆ isLoaded()

bool MlOnnxModel::isLoaded ( ) const
Returns
True if an ONNX Runtime session has been loaded and is ready for inference.

Definition at line 224 of file ml_onnx_model.cpp.

◆ load()

bool MlOnnxModel::load ( const QString & path)
overridevirtual

Load a model from disk.

Parameters
[in]pathFile path.
Returns
True if successful.

Implements MLLIB::MlModel.

Definition at line 154 of file ml_onnx_model.cpp.

◆ modelType()

QString MlOnnxModel::modelType ( ) const
overridevirtual
Returns
Human-readable model type name.

Implements MLLIB::MlModel.

Definition at line 235 of file ml_onnx_model.cpp.

◆ predict()

MlTensor MlOnnxModel::predict ( const MlTensor & input) const
overridevirtual

Run inference on the given input tensor.

Parameters
[in]inputThe input data.
Returns
The prediction result.

Implements MLLIB::MlModel.

Definition at line 93 of file ml_onnx_model.cpp.

◆ save()

bool MlOnnxModel::save ( const QString & path) const
overridevirtual

Serialise the model to disk.

Parameters
[in]pathFile path.
Returns
True if successful.

Implements MLLIB::MlModel.

Definition at line 145 of file ml_onnx_model.cpp.

◆ taskType()

MlTaskType MlOnnxModel::taskType ( ) const
overridevirtual
Returns
The task type this model is configured for.

Implements MLLIB::MlModel.

Definition at line 242 of file ml_onnx_model.cpp.


The documentation for this class was generated from the following files: