#include <Model.h>
Definition at line 21 of file Model.h.
◆ Model()
Ringer::onnx::Model::Model |
( |
const std::string & |
modelPath, |
|
|
AthOnnx::IOnnxRuntimeSvc * |
svc, |
|
|
float |
etmin, |
|
|
float |
etmax, |
|
|
float |
etamin, |
|
|
float |
etamax, |
|
|
unsigned |
barcode |
|
) |
| |
Constructor.
Definition at line 14 of file Model.cxx.
25 Ort::SessionOptions sessionOptions;
26 sessionOptions.SetIntraOpNumThreads( 1 );
27 sessionOptions.SetGraphOptimizationLevel( ORT_ENABLE_BASIC );
28 m_session = std::make_shared< Ort::Session >(
svc->env(), modelPath.c_str(), sessionOptions );
◆ ~Model()
Ringer::onnx::Model::~Model |
( |
| ) |
|
|
default |
◆ barcode()
unsigned Ringer::onnx::Model::barcode |
( |
| ) |
const |
|
inline |
◆ compile()
void Ringer::onnx::Model::compile |
( |
| ) |
|
Definition at line 32 of file Model.cxx.
34 Ort::AllocatorWithDefaultOptions allocator;
35 size_t num_input_nodes =
m_session->GetInputCount();
37 for( std::size_t
i = 0;
i < num_input_nodes;
i++ ) {
38 char* input_name =
m_session->GetInputNameAllocated(
i, allocator).release();
40 Ort::TypeInfo type_info =
m_session->GetInputTypeInfo(
i);
41 auto tensor_info = type_info.GetTensorTypeAndShapeInfo();
42 auto input_node_dims = tensor_info.GetShape();
43 for (std::size_t j = 0; j < input_node_dims.size(); j++){
44 if(input_node_dims[j]<0)
45 input_node_dims[j] =1;
52 size_t num_output_nodes =
m_session->GetOutputCount();
53 for( std::size_t
i = 0;
i < num_output_nodes;
i++ ) {
54 char* output_name =
m_session->GetOutputNameAllocated(
i, allocator).release();
◆ etaMax()
float Ringer::onnx::Model::etaMax |
( |
| ) |
const |
|
inline |
Get the Eta high edge.
Definition at line 45 of file Model.h.
◆ etaMin()
float Ringer::onnx::Model::etaMin |
( |
| ) |
const |
|
inline |
Get the Eta lower edge.
Definition at line 42 of file Model.h.
◆ etMax()
float Ringer::onnx::Model::etMax |
( |
| ) |
const |
|
inline |
Get the Et high edge.
Definition at line 39 of file Model.h.
◆ etMin()
float Ringer::onnx::Model::etMin |
( |
| ) |
const |
|
inline |
Get the Et lower edge.
Definition at line 36 of file Model.h.
◆ predict()
float Ringer::onnx::Model::predict |
( |
std::vector< std::vector< float > > & |
input_vecs | ) |
const |
Calculate the disriminant.
Definition at line 65 of file Model.cxx.
67 auto memory_info = Ort::MemoryInfo::CreateCpu(OrtArenaAllocator, OrtMemTypeDefault);
68 std::vector<Ort::Value> ort_inputs;
70 size_t num_inputs = input_vecs.size();
71 for(
size_t i=0;
i < num_inputs; ++
i ){
72 ort_inputs.emplace_back( Ort::Value::CreateTensor<float>(memory_info, input_vecs[
i].
data(),
81 assert(output_tensors.size() == 1 && output_tensors.front().IsTensor());
84 float* output_arr = output_tensors.front().GetTensorMutableData<
float>();
◆ m_barcode
unsigned Ringer::onnx::Model::m_barcode |
|
private |
◆ m_etamax
float Ringer::onnx::Model::m_etamax |
|
private |
◆ m_etamin
float Ringer::onnx::Model::m_etamin |
|
private |
◆ m_etmax
float Ringer::onnx::Model::m_etmax |
|
private |
◆ m_etmin
float Ringer::onnx::Model::m_etmin |
|
private |
◆ m_input_node_dims
std::vector<std::vector<int64_t> > Ringer::onnx::Model::m_input_node_dims |
|
private |
◆ m_input_node_names
std::vector<const char*> Ringer::onnx::Model::m_input_node_names |
|
private |
◆ m_output_node_dims
std::vector<int64_t> Ringer::onnx::Model::m_output_node_dims |
|
private |
◆ m_output_node_names
std::vector<const char*> Ringer::onnx::Model::m_output_node_names |
|
private |
◆ m_session
std::shared_ptr<Ort::Session> Ringer::onnx::Model::m_session |
|
private |
The documentation for this class was generated from the following files: