ATLAS Offline Software
OnnxRuntimeSvc.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2 
3 #ifndef ATHONNX_ONNXRUNTIMESVC_H
4 #define ATHONNX_ONNXRUNTIMESVC_H
5 
6 // Local include(s).
8 
9 // Framework include(s).
10 #include <AsgServices/AsgService.h>
11 
12 // ONNX include(s).
13 #include <onnxruntime_cxx_api.h>
14 
15 // System include(s).
16 #include <memory>
17 
18 namespace AthOnnx {
19 
27  class OnnxRuntimeSvc : public extends<asg::AsgService, IOnnxRuntimeSvc> {
28 
29  public:
30 
33  OnnxRuntimeSvc (const std::string& name, ISvcLocator* svc);
34 
36  virtual StatusCode initialize() override;
38  virtual StatusCode finalize() override;
39 
41 
44 
46  virtual Ort::Env& env() const override;
47 
49 
50  private:
52  std::unique_ptr< Ort::Env > m_env;
53 
54  }; // class OnnxRuntimeSvc
55 
56 } // namespace AthOnnx
57 
58 #endif // ATHONNX_ONNXRUNTIMESVC_H
AthOnnx::OnnxRuntimeSvc::finalize
virtual StatusCode finalize() override
Function finalising the service.
Definition: OnnxRuntimeSvc.cxx:28
AsgService.h
AthOnnx::OnnxRuntimeSvc::m_env
std::unique_ptr< Ort::Env > m_env
Global runtime environment for Onnx Runtime.
Definition: OnnxRuntimeSvc.h:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
AthOnnx::OnnxRuntimeSvc::env
virtual Ort::Env & env() const override
Return the Onnx Runtime environment object.
Definition: OnnxRuntimeSvc.cxx:38
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
IOnnxRuntimeSvc.h
AthOnnx::OnnxRuntimeSvc::initialize
virtual StatusCode initialize() override
Function initialising the service.
Definition: OnnxRuntimeSvc.cxx:13
AthOnnx::OnnxRuntimeSvc
Service implementing AthOnnx::IOnnxRuntimeSvc.
Definition: OnnxRuntimeSvc.h:27
AthOnnx::OnnxRuntimeSvc::OnnxRuntimeSvc
OnnxRuntimeSvc(const std::string &name, ISvcLocator *svc)
Definition: OnnxRuntimeSvc.cxx:8
AthOnnx
Namespace holding all of the Onnx Runtime example code.
Definition: EvaluateModel.cxx:11