EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
ONNXInference.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// Copyright (C) 2022 - 2024 Sylvester Joosten, Dmitry Romanov, Wouter Deconinck, Dmitry Kalinkin
3
4#pragma once
5
6#include <algorithms/algorithm.h>
7#include <cstdint>
8#include <onnxruntime_cxx_api.h>
9#include <string>
10#include <string_view>
11#include <vector>
12#include <edm4eic/TensorCollection.h>
13
16
17namespace eicrecon {
18
20 algorithms::Algorithm<algorithms::Input<std::vector<edm4eic::TensorCollection>>,
21 algorithms::Output<std::vector<edm4eic::TensorCollection>>>;
22
23class ONNXInference : public ONNXInferenceAlgorithm, public WithPodConfig<ONNXInferenceConfig> {
24
25public:
26 ONNXInference(std::string_view name)
27 : ONNXInferenceAlgorithm{name, {"inputTensors"}, {"outputTensors"}, ""} {}
28
29 void init() final;
30 void process(const Input&, const Output&) const final;
31
32private:
33 mutable Ort::Env m_env{nullptr};
34 mutable Ort::Session m_session{nullptr};
35
36 std::vector<std::string> m_input_names;
37 std::vector<const char*> m_input_names_char;
38 std::vector<std::vector<std::int64_t>> m_input_shapes;
39
40 std::vector<std::string> m_output_names;
41 std::vector<const char*> m_output_names_char;
42 std::vector<std::vector<std::int64_t>> m_output_shapes;
43};
44
45} // namespace eicrecon
Definition ONNXInference.h:23
ONNXInference(std::string_view name)
Definition ONNXInference.h:26
Definition WithPodConfig.h:22
-client
Definition CalorimeterClusterRecoCoG.cc:37
algorithms::Algorithm< algorithms::Input< std::vector< edm4eic::TensorCollection > >, algorithms::Output< std::vector< edm4eic::TensorCollection > > > ONNXInferenceAlgorithm
Definition ONNXInference.h:21