ATLAS Offline Software
Model.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef RingerSelectorTools_tools_onnx_Model_h
6 #define RingerSelectorTools_tools_onnx_Model_h
7 
9 #include <onnxruntime_cxx_api.h>
11 #include <assert.h>
12 #include <vector>
13 
14 
15 
16 
17 namespace Ringer{
18 
19  namespace onnx{
20 
21  class Model
22  {
23  public:
24 
26  Model( const std::string& modelPath, AthOnnx::IOnnxRuntimeSvc *svc,
27  float etmin, float etmax, float etamin, float etamax,
28  unsigned barcode);
29 
31  ~Model()=default;
32 
33  void compile();
34 
36  float etMin() const { return m_etmin; };
37 
39  float etMax() const { return m_etmax; };
40 
42  float etaMin() const { return m_etamin; };
43 
45  float etaMax() const { return m_etamax; };
46 
48  float predict ( std::vector< std::vector<float> > & ) const;
49 
50  unsigned barcode() const { return m_barcode; };
51 
52  private:
53 
54  // onnx session
55  std::shared_ptr<Ort::Session> m_session;
56  std::vector<std::vector<int64_t>> m_input_node_dims;
57  std::vector<int64_t> m_output_node_dims;
58  std::vector<const char*> m_input_node_names;
59  std::vector<const char*> m_output_node_names;
60 
61  float m_etmin, m_etmax;
63  unsigned m_barcode;
64 
65 
66  };
67 
68  } // namepace onnx
69 
70 }// namespace ringer
71 
72 #endif
AthOnnx::IOnnxRuntimeSvc
Service used for managing global objects used by Onnx Runtime.
Definition: IOnnxRuntimeSvc.h:25
Ringer::onnx::Model::compile
void compile()
Definition: Model.cxx:32
Ringer::onnx::Model::m_input_node_dims
std::vector< std::vector< int64_t > > m_input_node_dims
Definition: Model.h:56
Ringer::onnx::Model::~Model
~Model()=default
Destructor.
Ringer::onnx::Model::predict
float predict(std::vector< std::vector< float > > &) const
Calculate the disriminant.
Definition: Model.cxx:65
Ringer::onnx::Model::etaMin
float etaMin() const
Get the Eta lower edge.
Definition: Model.h:42
Ringer::onnx::Model::m_output_node_names
std::vector< const char * > m_output_node_names
Definition: Model.h:59
Ringer::onnx::Model::m_barcode
unsigned m_barcode
Definition: Model.h:63
AsgMessaging.h
Ringer::onnx::Model::m_etamax
float m_etamax
Definition: Model.h:62
Ringer::onnx::Model::m_output_node_dims
std::vector< int64_t > m_output_node_dims
Definition: Model.h:57
Ringer::onnx::Model::m_etmax
float m_etmax
Definition: Model.h:61
Ringer::onnx::Model::m_input_node_names
std::vector< const char * > m_input_node_names
Definition: Model.h:58
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
Ringer::onnx::Model::m_etamin
float m_etamin
Definition: Model.h:62
Ringer::onnx::Model::m_session
std::shared_ptr< Ort::Session > m_session
Definition: Model.h:50
Ringer::onnx::Model::etaMax
float etaMax() const
Get the Eta high edge.
Definition: Model.h:45
IOnnxRuntimeSvc.h
Ringer::onnx::Model::m_etmin
float m_etmin
Definition: Model.h:61
Ringer::onnx::Model::barcode
unsigned barcode() const
Definition: Model.h:50
Ringer::onnx::Model::Model
Model(const std::string &modelPath, AthOnnx::IOnnxRuntimeSvc *svc, float etmin, float etmax, float etamin, float etamax, unsigned barcode)
Constructor.
Definition: Model.cxx:14
LArCellBinning.etamin
etamin
Definition: LArCellBinning.py:137
Ringer::onnx::Model::etMin
float etMin() const
Get the Et lower edge.
Definition: Model.h:36
Ringer::onnx::Model
Definition: Model.h:22
Ringer::onnx::Model::etMax
float etMax() const
Get the Et high edge.
Definition: Model.h:39
Ringer
Namespace dedicated for Ringer utilities.
Definition: CaloRingsDefs.h:9