11#include <boost/property_tree/ptree.hpp>
21 const std::string ending =
".*";
22 const int ending_len = ending.length();
23 const int filename_len = filename.length();
24 if (filename_len < ending_len) {
27 filename.compare(filename_len - ending_len, ending_len, ending)) {
31 if (std::filesystem::exists(filename +
"onnx")) {
33 }
else if (std::filesystem::exists(filename +
"json")) {
34 filename += std::string(
"json");
36 throw std::invalid_argument(
"No file found matching globbed filename " +
44 const std::string ending =
".onnx";
45 const int ending_len = ending.length();
46 const int filename_len = filename.length();
48 if (filename_len < ending_len) {
52 (0 == filename.compare(filename_len - ending_len, ending_len, ending));
57std::unique_ptr<VNetworkBase>
71 << input.substr(input.length() - 10));
78 "Succedeed in creating LWTNN nn from string starting "
79 << input.substr(0, 10));
81 }
catch (
const boost::property_tree::ptree_bad_path &e) {
96 << input.substr(input.length() - 10));
99 }
else if (graph_form) {
110std::unique_ptr<VNetworkBase>
112 std::string string_input) {
116 if (vector_input.size() > 0) {
118 "Bytes contains data, size=" << vector_input.size()
119 <<
", creating from bytes.");
120 return create(vector_input);
121 }
else if (string_input.length() > 0) {
123 <<
"creating from string.");
124 return create(std::move(string_input));
126 throw std::invalid_argument(
127 "Neither vector_input nor string_input contain data");
131std::unique_ptr<VNetworkBase>
133 std::string string_input,
bool graph_form) {
137 "Given both bytes, a string and graph form sepcified to create an nn.");
139 if (vector_input.size() > 0) {
141 "Bytes contains data, size=" << vector_input.size()
142 <<
", creating from bytes.");
143 return create(vector_input);
144 }
else if (string_input.length() > 0) {
146 <<
"creating from string.");
147 return create(std::move(string_input), graph_form);
149 throw std::invalid_argument(
150 "Neither vector_input nor string_input contain data");
#define ATH_MSG_NOCLASS(logger_name, x)
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
static bool isOnnxFile(std::string const &filename)
Check if a filename seems to be an onnx file.
static std::unique_ptr< VNetworkBase > create(std::string input)
Given a string, make a network.
static void resolveGlobs(std::string &filename)
If the filepath ends in .
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration.
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration.
static bool isFile(std::string const &inputFile)
Check if a string is the path of a file on disk.
static Root::TMsgLogger logger("iLumiCalc")