ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExOnnxRuntime
src
EvaluateModelWithAsyncInfer.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
2
3
#ifndef ATHEXONNXRUNTIME_EVALUATEMODELWithAsyncInfer_H
4
#define ATHEXONNXRUNTIME_EVALUATEMODELWithAsyncInfer_H
5
6
// Local include(s).
7
#include "
AthOnnxInterfaces/IAthInferenceTool.h
"
8
9
// Framework include(s).
10
#include "
AthenaBaseComps/AthAsynchronousAlgorithm.h
"
11
#include "GaudiKernel/ServiceHandle.h"
12
13
// Onnx Runtime include(s).
14
#include <onnxruntime_cxx_api.h>
15
16
// System include(s).
17
#include <string>
18
#include <vector>
19
20
namespace
AthOnnx
{
21
29
class
EvaluateModelWithAsyncInfer
:
public
AthAsynchronousAlgorithm
{
30
31
public
:
33
using
AthAsynchronousAlgorithm::AthAsynchronousAlgorithm;
34
37
39
virtual
StatusCode
initialize
()
override
;
41
virtual
StatusCode
execute
(
const
EventContext& ctx)
const override
;
42
44
45
private
:
48
50
Gaudi::Property<std::string>
m_pixelFileName
{
51
this
,
"InputDataPixel"
,
"dev/MLTest/2020-03-31/t10k-images-idx3-ubyte"
,
52
"Name of the input pixel file to load"
};
53
56
Gaudi::Property<int>
m_batchSize
{
this
,
"BatchSize"
, 1,
57
"No. of elements/example in a batch"
};
58
60
ToolHandle<AthInfer::IAthInferenceTool>
m_onnxTool
{
61
this
,
"ORTInferenceTool"
,
"AthOnnx::OnnxRuntimeInferenceTool"
};
62
63
std::vector<std::vector<std::vector<float>>>
m_input_tensor_values_notFlat
;
64
65
};
// class EvaluateModel
66
67
}
// namespace AthOnnx
68
69
#endif
// ATHEXONNXRUNTIME_EVALUATEMODELWithAsyncInfer_H
AthAsynchronousAlgorithm.h
IAthInferenceTool.h
AthAsynchronousAlgorithm
An algorithm that can be suspended while work is offloaded to an accelerator.
Definition
AthAsynchronousAlgorithm.h:28
AthOnnx::EvaluateModelWithAsyncInfer
Algorithm demonstrating the usage of the ONNX Runtime C++ API.
Definition
EvaluateModelWithAsyncInfer.h:29
AthOnnx::EvaluateModelWithAsyncInfer::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm for a single event.
Definition
EvaluateModelWithAsyncInfer.cxx:61
AthOnnx::EvaluateModelWithAsyncInfer::m_pixelFileName
Gaudi::Property< std::string > m_pixelFileName
Name of the input file to load.
Definition
EvaluateModelWithAsyncInfer.h:50
AthOnnx::EvaluateModelWithAsyncInfer::m_input_tensor_values_notFlat
std::vector< std::vector< std::vector< float > > > m_input_tensor_values_notFlat
Definition
EvaluateModelWithAsyncInfer.h:63
AthOnnx::EvaluateModelWithAsyncInfer::m_batchSize
Gaudi::Property< int > m_batchSize
Following properties needed to be consdered if the .onnx model is evaluated in batch mode.
Definition
EvaluateModelWithAsyncInfer.h:56
AthOnnx::EvaluateModelWithAsyncInfer::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition
EvaluateModelWithAsyncInfer.cxx:18
AthOnnx::EvaluateModelWithAsyncInfer::m_onnxTool
ToolHandle< AthInfer::IAthInferenceTool > m_onnxTool
Tool handler for onnx inference session.
Definition
EvaluateModelWithAsyncInfer.h:60
AthOnnx
Namespace holding all of the Onnx Runtime example code.
Definition
EvaluateModel.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0