OpenMS
Loading...
Searching...
No Matches
ONNXPredictorBase Class Reference

#include <OpenMS/ML/ONNX/ONNXPredictorBase.h>

Collaboration diagram for ONNXPredictorBase:
[legend]

Public Member Functions

 ONNXPredictorBase (const std::string &model_path, int intra_op_threads=4)
 Constructor initializes the generic ONNX session safely across platforms.
 
virtual ~ONNXPredictorBase ()
 
 ONNXPredictorBase (const ONNXPredictorBase &)=delete
 
ONNXPredictorBaseoperator= (const ONNXPredictorBase &)=delete
 
 ONNXPredictorBase (ONNXPredictorBase &&) noexcept
 
ONNXPredictorBaseoperator= (ONNXPredictorBase &&) noexcept
 
Ort::Session & session ()
 Access the wrapped ONNX Runtime session.
 
const Ort::Session & session () const
 
Ort::MemoryInfo & memoryInfo ()
 Access CPU memory info used to construct input tensors.
 
const Ort::MemoryInfo & memoryInfo () const
 
std::vector< std::string > getInputNames () const
 Return model input names in ONNX graph order.
 
std::vector< std::string > getOutputNames () const
 Return model output names in ONNX graph order.
 
std::vector< int64_t > getInputShape (size_t input_index) const
 Return the declared input shape for an input index.
 
size_t getInputCount () const
 Return the number of model inputs.
 
size_t getOutputCount () const
 Return the number of model outputs.
 

Private Attributes

std::unique_ptr< Ort::SessionOptions > session_options_
 
std::unique_ptr< Ort::Session > session_
 
std::unique_ptr< Ort::MemoryInfo > memory_info_
 

Constructor & Destructor Documentation

◆ ONNXPredictorBase() [1/3]

ONNXPredictorBase ( const std::string &  model_path,
int  intra_op_threads = 4 
)
explicit

Constructor initializes the generic ONNX session safely across platforms.

Parameters
model_pathPath to the ONNX model file.
intra_op_threadsNumber of ONNX execution threads (default 4 based on profiling).

◆ ~ONNXPredictorBase()

virtual ~ONNXPredictorBase ( )
virtual

◆ ONNXPredictorBase() [2/3]

ONNXPredictorBase ( const ONNXPredictorBase )
delete

◆ ONNXPredictorBase() [3/3]

Member Function Documentation

◆ getInputCount()

size_t getInputCount ( ) const

Return the number of model inputs.

◆ getInputNames()

std::vector< std::string > getInputNames ( ) const

Return model input names in ONNX graph order.

◆ getInputShape()

std::vector< int64_t > getInputShape ( size_t  input_index) const

Return the declared input shape for an input index.

◆ getOutputCount()

size_t getOutputCount ( ) const

Return the number of model outputs.

◆ getOutputNames()

std::vector< std::string > getOutputNames ( ) const

Return model output names in ONNX graph order.

◆ memoryInfo() [1/2]

Ort::MemoryInfo & memoryInfo ( )

Access CPU memory info used to construct input tensors.

◆ memoryInfo() [2/2]

const Ort::MemoryInfo & memoryInfo ( ) const

◆ operator=() [1/2]

ONNXPredictorBase & operator= ( const ONNXPredictorBase )
delete

◆ operator=() [2/2]

ONNXPredictorBase & operator= ( ONNXPredictorBase &&  )
noexcept

◆ session() [1/2]

Ort::Session & session ( )

Access the wrapped ONNX Runtime session.

◆ session() [2/2]

const Ort::Session & session ( ) const

Member Data Documentation

◆ memory_info_

std::unique_ptr<Ort::MemoryInfo> memory_info_
private

◆ session_

std::unique_ptr<Ort::Session> session_
private

◆ session_options_

std::unique_ptr<Ort::SessionOptions> session_options_
private