![]() |
OpenMS
|
Owns the ONNX Runtime session of one model file, for the predictors built on it. More...
#include <OpenMS/ML/ONNX/ONNXPredictorBase.h>
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 | |
| ONNXPredictorBase & | operator= (const ONNXPredictorBase &)=delete |
| ONNXPredictorBase (ONNXPredictorBase &&) noexcept | |
| ONNXPredictorBase & | operator= (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_ |
Owns the ONNX Runtime session of one model file, for the predictors built on it.
Loads the model with all graph optimizations and the given number of intra-op threads, and gives a predictor (PeptDeepRTInference, PeptDeepCCSInference, PeptDeepMS2Inference) the session and the CPU memory info it needs to build input tensors. The ONNX Runtime types are only forward-declared here. Available in builds with WITH_ONNX.
|
explicit |
Constructor initializes the generic ONNX session safely across platforms.
| model_path | Path to the ONNX model file. |
| intra_op_threads | Number of ONNX execution threads (default 4 based on profiling). |
|
virtual |
|
delete |
|
noexcept |
| size_t getInputCount | ( | ) | const |
Return the number of model inputs.
| std::vector< std::string > getInputNames | ( | ) | const |
Return model input 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 getOutputCount | ( | ) | const |
Return the number of model outputs.
| std::vector< std::string > getOutputNames | ( | ) | const |
Return model output names in ONNX graph order.
| Ort::MemoryInfo & memoryInfo | ( | ) |
Access CPU memory info used to construct input tensors.
| const Ort::MemoryInfo & memoryInfo | ( | ) | const |
|
delete |
|
noexcept |
| Ort::Session & session | ( | ) |
Access the wrapped ONNX Runtime session.
| const Ort::Session & session | ( | ) | const |
|
private |
|
private |
|
private |