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)) {
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));
57 std::unique_ptr<VNetworkBase>
78 "Succedeed in creating LWTNN nn from string starting "
79 <<
input.substr(0, 10));
81 }
catch (
const boost::property_tree::ptree_bad_path &
e) {
99 }
else if (graph_form) {
110 std::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(string_input);
126 throw std::invalid_argument(
127 "Neither vector_input nor string_input contain data");
131 std::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(string_input, graph_form);
149 throw std::invalid_argument(
150 "Neither vector_input nor string_input contain data");