ATLAS Offline Software
Loading...
Searching...
No Matches
METNetHandler.h File Reference
#include <string>
#include <mutex>
#include <onnxruntime_cxx_api.h>
#include "CxxUtils/checker_macros.h"
#include <ColumnarMode/ColumnarMode.h>
Include dependency graph for METNetHandler.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

namespace ADD_CMODE (met)

Function Documentation

◆ ADD_CMODE()

namespace ADD_CMODE ( met )

Definition at line 1 of file METNetHandler.h.

23 {
24
25 class METNetHandler {
26
27 public:
28
29 // Constructor with parameters
30 METNetHandler(const std::string& modelName);
31
32 // Destructor
33 virtual ~METNetHandler() = default;
34
35 // Public methods
36 int initialize();
37 unsigned int getReqSize() const;
38 void predict(std::vector<float>& outputs, std::vector<float>& inputs) const;
39
40 private:
41
42 // Default constructor
43 METNetHandler() = delete;
44
45 // Class properties
46 std::string m_modelName; // Path to the onnx file
47 std::string m_modelPath; // Output of the path resolver
48
49 // Features of the network structure
50 size_t m_numInputs;
51 size_t m_numOutputs;
52 std::vector<int64_t> m_inputDims;
53 std::vector<int64_t> m_outputDims;
54 std::vector<const char *> m_graphInputNames;
55 std::vector<const char *> m_graphOutputNames;
56
57 // ONNX session objects
58 Ort::Env m_onnxEnv;
59 Ort::SessionOptions m_onnxSessionOptions;
60 Ort::AllocatorWithDefaultOptions m_onnxAllocator;
61 mutable std::unique_ptr<Ort::Session> m_onnxSession ATLAS_THREAD_SAFE {nullptr};
62 mutable std::mutex m_onnxMutex ATLAS_THREAD_SAFE;
63 };
64
65}
#define ATLAS_THREAD_SAFE
void initialize()