ATLAS Offline Software
Loading...
Searching...
No Matches
NNSharingTritonSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
8
9namespace FlavorTagInference {
10
11 std::shared_ptr<const GNN> NNSharingTritonSvc::get(
12 const std::string& nn_name,
13 const GNNOptions& opts
14 ) {
15 NNHashing::NNKey key{nn_name, opts};
16 if (m_gnns.count(key)) {
17 ATH_MSG_INFO("getting " << nn_name << " from cached NNs");
18 return m_gnns.at(key);
19 } else if (m_base_gnns.count(nn_name) ) {
20 ATH_MSG_INFO("adapting " << nn_name << " from cached NNs, new opts");
21 auto nn = std::make_shared<const GNN>(*m_base_gnns.at(nn_name), opts);
22 m_gnns[key] = nn;
23 return nn;
24 }
25 std::shared_ptr<const GNN> nn;
26 if(auto it = m_tritonPathToName.find(nn_name); it!=m_tritonPathToName.end()) {
27 ATH_MSG_INFO("building " << nn_name << " from onnx file to run with Triton");
28 //using namespace FlavorTagInference;
29 std::string fullPathToOnnxFile = PathResolverFindCalibFile(nn_name);
30 auto saltSharedTriton = std::make_shared<const SaltModelTriton>(fullPathToOnnxFile
31 , it->second
37 ISaltModelPtr saltShared = saltSharedTriton;
38 nn = std::make_shared<const GNN>(saltShared, opts);
39 }
40 m_base_gnns[nn_name] = nn;
41 m_gnns[key] = nn;
42 return nn;
43 }
45 return StatusCode::SUCCESS;
46 }
47}
#define ATH_MSG_INFO(x)
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
virtual StatusCode initialize() override
Gaudi::Property< std::string > m_tritonBearer
virtual std::shared_ptr< const GNN > get(const std::string &nn_name, const GNNOptions &opts) override
std::unordered_map< std::string, val_t > m_base_gnns
Gaudi::Property< std::map< std::string, std::string > > m_tritonPathToName
Gaudi::Property< std::string > m_tritonUrl
std::unordered_map< NNHashing::NNKey, val_t, NNHashing::NNHasher > m_gnns
This file contains "getter" functions used for accessing tagger inputs from the EDM.
std::shared_ptr< const ISaltModel > ISaltModelPtr
Definition ISaltModel.h:56