ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExOnnxRuntime
src
EvaluateModelWithAthInfer.h
Go to the documentation of this file.
1
// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
#ifndef ATHEXONNXRUNTIME_EVALUATEMODELWithAthInfer_H
4
#define ATHEXONNXRUNTIME_EVALUATEMODELWithAthInfer_H
5
6
// Local include(s).
7
#include "
AthOnnxInterfaces/IAthInferenceTool.h
"
8
9
// Framework include(s).
10
#include "
AthenaBaseComps/AthReentrantAlgorithm.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
EvaluateModelWithAthInfer
:
public
AthReentrantAlgorithm
{
30
31
public
:
33
using
AthReentrantAlgorithm::AthReentrantAlgorithm;
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
{
this
,
"InputDataPixel"
,
51
"dev/MLTest/2020-03-31/t10k-images-idx3-ubyte"
,
52
"Name of the input pixel file to load"
};
53
55
Gaudi::Property<int>
m_batchSize
{
this
,
"BatchSize"
, 1,
"No. of elements/example in a batch"
};
56
58
ToolHandle< AthInfer::IAthInferenceTool >
m_onnxTool
{
59
this
,
"ORTInferenceTool"
,
"AthOnnx::OnnxRuntimeInferenceTool"
60
};
61
62
std::vector<std::vector<std::vector<float>>>
m_input_tensor_values_notFlat
;
63
64
};
// class EvaluateModel
65
66
}
// namespace AthOnnx
67
68
#endif
// ATHEXONNXRUNTIME_EVALUATEMODEL_H
AthReentrantAlgorithm.h
IAthInferenceTool.h
AthOnnx::EvaluateModelWithAthInfer
Algorithm demonstrating the usage of the ONNX Runtime C++ API.
Definition
EvaluateModelWithAthInfer.h:29
AthOnnx::EvaluateModelWithAthInfer::m_input_tensor_values_notFlat
std::vector< std::vector< std::vector< float > > > m_input_tensor_values_notFlat
Definition
EvaluateModelWithAthInfer.h:62
AthOnnx::EvaluateModelWithAthInfer::m_pixelFileName
Gaudi::Property< std::string > m_pixelFileName
Name of the model file to load.
Definition
EvaluateModelWithAthInfer.h:50
AthOnnx::EvaluateModelWithAthInfer::m_onnxTool
ToolHandle< AthInfer::IAthInferenceTool > m_onnxTool
Tool handler for onnx inference session.
Definition
EvaluateModelWithAthInfer.h:58
AthOnnx::EvaluateModelWithAthInfer::m_batchSize
Gaudi::Property< int > m_batchSize
Following properties needed to be consdered if the .onnx model is evaluated in batch mode.
Definition
EvaluateModelWithAthInfer.h:55
AthOnnx::EvaluateModelWithAthInfer::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition
EvaluateModelWithAthInfer.cxx:18
AthOnnx::EvaluateModelWithAthInfer::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm for a single event.
Definition
EvaluateModelWithAthInfer.cxx:61
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
AthOnnx
Namespace holding all of the Onnx Runtime example code.
Definition
EvaluateModel.cxx:11
Generated on
for ATLAS Offline Software by
1.17.0