ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Control
AthenaExamples
AthExOnnxRuntime
src
EvaluateModel.h
Go to the documentation of this file.
1
// Dear emacs, this is -*- c++ -*-
2
// Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
#ifndef ATHEXONNXRUNTIME_EVALUATEMODEL_H
4
#define ATHEXONNXRUNTIME_EVALUATEMODEL_H
5
6
// Local include(s).
7
#include "
AthOnnxInterfaces/IOnnxRuntimeInferenceTool.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 <memory>
18
#include <string>
19
#include <vector>
20
21
namespace
AthOnnx
{
22
30
class
EvaluateModel
:
public
AthReentrantAlgorithm
{
31
32
public
:
34
using
AthReentrantAlgorithm::AthReentrantAlgorithm;
35
38
40
virtual
StatusCode
initialize
()
override
;
42
virtual
StatusCode
execute
(
const
EventContext& ctx )
const override
;
43
45
46
private
:
49
51
Gaudi::Property< std::string >
m_pixelFileName
{
this
,
"InputDataPixel"
,
52
"dev/MLTest/2020-03-31/t10k-images-idx3-ubyte"
,
53
"Name of the input pixel file to load"
};
54
56
Gaudi::Property<int>
m_batchSize
{
this
,
"BatchSize"
, 1,
"No. of elements/example in a batch"
};
57
59
ToolHandle< IOnnxRuntimeInferenceTool >
m_onnxTool
{
60
this
,
"ORTInferenceTool"
,
"AthOnnx::OnnxRuntimeInferenceTool"
61
};
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_EVALUATEMODEL_H
AthReentrantAlgorithm.h
IOnnxRuntimeInferenceTool.h
AthOnnx::EvaluateModel
Algorithm demonstrating the usage of the ONNX Runtime C++ API.
Definition
EvaluateModel.h:30
AthOnnx::EvaluateModel::execute
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm for a single event.
Definition
EvaluateModel.cxx:36
AthOnnx::EvaluateModel::m_pixelFileName
Gaudi::Property< std::string > m_pixelFileName
Name of the model file to load.
Definition
EvaluateModel.h:51
AthOnnx::EvaluateModel::initialize
virtual StatusCode initialize() override
Function initialising the algorithm.
Definition
EvaluateModel.cxx:13
AthOnnx::EvaluateModel::m_onnxTool
ToolHandle< IOnnxRuntimeInferenceTool > m_onnxTool
Tool handler for onnx inference session.
Definition
EvaluateModel.h:59
AthOnnx::EvaluateModel::m_batchSize
Gaudi::Property< int > m_batchSize
Following properties needed to be consdered if the .onnx model is evaluated in batch mode.
Definition
EvaluateModel.h:56
AthOnnx::EvaluateModel::m_input_tensor_values_notFlat
std::vector< std::vector< std::vector< float > > > m_input_tensor_values_notFlat
Definition
EvaluateModel.h:63
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