ATLAS Offline Software
Loading...
Searching...
No Matches
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).
8
9// Framework include(s).
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
21namespace AthOnnx {
22
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
Algorithm demonstrating the usage of the ONNX Runtime C++ API.
virtual StatusCode execute(const EventContext &ctx) const override
Function executing the algorithm for a single event.
Gaudi::Property< std::string > m_pixelFileName
Name of the model file to load.
virtual StatusCode initialize() override
Function initialising the algorithm.
ToolHandle< IOnnxRuntimeInferenceTool > m_onnxTool
Tool handler for onnx inference session.
Gaudi::Property< int > m_batchSize
Following properties needed to be consdered if the .onnx model is evaluated in batch mode.
std::vector< std::vector< std::vector< float > > > m_input_tensor_values_notFlat
An algorithm that can be simultaneously executed in multiple threads.
Namespace holding all of the Onnx Runtime example code.