ATLAS Offline Software
Loading...
Searching...
No Matches
NNSharingOnnxSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
7
8namespace FlavorTagInference {
9
10 std::shared_ptr<const GNN> NNSharingOnnxSvc::get(
11 const std::string& nn_name,
12 const GNNOptions& opts) {
13 NNHashing::NNKey key{nn_name, opts};
14 if (m_gnns.count(key)) {
15 ATH_MSG_INFO("getting " << nn_name << " from cached NNs");
16 return m_gnns.at(key);
17 } else if (m_base_gnns.count(nn_name) ) {
18 ATH_MSG_INFO("adapting " << nn_name << " from cached NNs, new opts");
19 auto nn = std::make_shared<const GNN>(*m_base_gnns.at(nn_name), opts);
20 m_gnns[key] = nn;
21 return nn;
22 }
23 std::shared_ptr<const GNN> nn;
24 ATH_MSG_INFO("building " << nn_name << " from onnx file");
25 nn = std::make_shared<const GNN>(nn_name, opts);
26 m_base_gnns[nn_name] = nn;
27 m_gnns[key] = nn;
28 return nn;
29 }
30}
#define ATH_MSG_INFO(x)
std::unordered_map< NNHashing::NNKey, val_t, NNHashing::NNHasher > m_gnns
std::unordered_map< std::string, val_t > m_base_gnns
virtual std::shared_ptr< const GNN > get(const std::string &nn_name, const GNNOptions &opts) override
This file contains "getter" functions used for accessing tagger inputs from the EDM.