ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
MET
METUtilities
METUtilities
METNetHandler.h
Go to the documentation of this file.
1
2
/*
3
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4
*/
5
// Author: Bill Balunas <balunas@cern.ch>, based on earlier implementation by M. Leigh
7
8
#ifndef METUTILITIES_MET_METNETHANDLER_H
9
#define METUTILITIES_MET_METNETHANDLER_H
10
11
// STL includes
12
#include <string>
13
#include <mutex>
14
15
// ONNX Library
16
#include <onnxruntime_cxx_api.h>
17
18
// For ATLAS_THREAD_SAFE
19
#include "
CxxUtils/checker_macros.h
"
20
21
namespace
met
{
22
23
class
METNetHandler
{
24
25
public
:
26
27
// Constructor with parameters
28
METNetHandler
(
const
std::string& modelName);
29
30
// Destructor
31
virtual
~METNetHandler
() =
default
;
32
33
// Public methods
34
int
initialize
();
35
unsigned
int
getReqSize
()
const
;
36
void
predict
(std::vector<float>& outputs, std::vector<float>& inputs)
const
;
37
38
private
:
39
40
// Default constructor
41
METNetHandler
() =
delete
;
42
43
// Class properties
44
std::string
m_modelName
;
// Path to the onnx file
45
std::string
m_modelPath
;
// Output of the path resolver
46
47
// Features of the network structure
48
size_t
m_numInputs
;
49
size_t
m_numOutputs
;
50
std::vector<int64_t>
m_inputDims
;
51
std::vector<int64_t>
m_outputDims
;
52
std::vector<const char *>
m_graphInputNames
;
53
std::vector<const char *>
m_graphOutputNames
;
54
55
// ONNX session objects
56
Ort::Env
m_onnxEnv
;
57
Ort::SessionOptions
m_onnxSessionOptions
;
58
Ort::AllocatorWithDefaultOptions
m_onnxAllocator
;
59
mutable
std::unique_ptr<Ort::Session> m_onnxSession
ATLAS_THREAD_SAFE
{
nullptr
};
60
mutable
std::mutex m_onnxMutex
ATLAS_THREAD_SAFE
;
61
};
62
63
}
64
65
#endif
checker_macros.h
Define macros for attributes used to control the static checker.
met::METNetHandler::m_onnxSessionOptions
Ort::SessionOptions m_onnxSessionOptions
Definition
METNetHandler.h:57
met::METNetHandler::m_onnxAllocator
Ort::AllocatorWithDefaultOptions m_onnxAllocator
Definition
METNetHandler.h:58
met::METNetHandler::m_modelPath
std::string m_modelPath
Definition
METNetHandler.h:45
met::METNetHandler::m_graphInputNames
std::vector< const char * > m_graphInputNames
Definition
METNetHandler.h:52
met::METNetHandler::METNetHandler
METNetHandler()=delete
met::METNetHandler::initialize
int initialize()
Definition
METNetHandler.cxx:24
met::METNetHandler::getReqSize
unsigned int getReqSize() const
Definition
METNetHandler.cxx:40
met::METNetHandler::m_graphOutputNames
std::vector< const char * > m_graphOutputNames
Definition
METNetHandler.h:53
met::METNetHandler::m_outputDims
std::vector< int64_t > m_outputDims
Definition
METNetHandler.h:51
met::METNetHandler::m_inputDims
std::vector< int64_t > m_inputDims
Definition
METNetHandler.h:50
met::METNetHandler::METNetHandler
METNetHandler(const std::string &modelName)
Definition
METNetHandler.cxx:15
met::METNetHandler::m_modelName
std::string m_modelName
Definition
METNetHandler.h:44
met::METNetHandler::m_numOutputs
size_t m_numOutputs
Definition
METNetHandler.h:49
met::METNetHandler::m_numInputs
size_t m_numInputs
Definition
METNetHandler.h:48
met::METNetHandler::predict
void predict(std::vector< float > &outputs, std::vector< float > &inputs) const
Definition
METNetHandler.cxx:45
met::METNetHandler::ATLAS_THREAD_SAFE
std::unique_ptr< Ort::Session > m_onnxSession ATLAS_THREAD_SAFE
Definition
METNetHandler.h:59
met::METNetHandler::m_onnxEnv
Ort::Env m_onnxEnv
Definition
METNetHandler.h:56
met::METNetHandler::~METNetHandler
virtual ~METNetHandler()=default
met
Definition
IMETSignificance.h:24
Generated on
for ATLAS Offline Software by
1.17.0