ATLAS Offline Software
Loading...
Searching...
No Matches
PhysicsAnalysis
JetTagging
FlavorTagInference
Root
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
5
#include "
FlavorTagInference/NNSharingOnnxSvc.h
"
6
#include "
PathResolver/PathResolver.h
"
7
8
namespace
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
}
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
NNSharingOnnxSvc.h
PathResolver.h
FlavorTagInference::NNSharingOnnxSvc::m_gnns
std::unordered_map< NNHashing::NNKey, val_t, NNHashing::NNHasher > m_gnns
Definition
NNSharingOnnxSvc.h:22
FlavorTagInference::NNSharingOnnxSvc::m_base_gnns
std::unordered_map< std::string, val_t > m_base_gnns
Definition
NNSharingOnnxSvc.h:23
FlavorTagInference::NNSharingOnnxSvc::get
virtual std::shared_ptr< const GNN > get(const std::string &nn_name, const GNNOptions &opts) override
Definition
NNSharingOnnxSvc.cxx:10
FlavorTagInference
This file contains "getter" functions used for accessing tagger inputs from the EDM.
Definition
PhysicsAnalysis/JetTagging/FlavorTagInference/FlavorTagInference/ConstituentsLoader.h:27
FlavorTagInference::GNNOptions
Definition
GNNOptions.h:15
FlavorTagInference::NNHashing::NNKey
Definition
hash.h:27
Generated on
for ATLAS Offline Software by
1.14.0