@@ -194,21 +194,23 @@ void build_graph(it_lab_ai::Graph& graph, it_lab_ai::Tensor& input,
194194 }
195195
196196 try {
197- std::sort (
198- connection_list.begin (), connection_list.end (),
199- [&](const auto & a, const auto & b) {
200- if (!name_to_layer.count (a.first ) || !name_to_layer.count (b.first )) {
201- return false ;
202- }
203- return name_to_layer[a.first ]->getID () <
204- name_to_layer[b.first ]->getID ();
205- });
197+ std::sort (connection_list.begin (), connection_list.end (),
198+ [&](const auto & a, const auto & b) {
199+ if (!name_to_layer.contains (a.first ) ||
200+ !name_to_layer.contains (b.first )) {
201+ return false ;
202+ }
203+ return name_to_layer[a.first ]->getID () <
204+ name_to_layer[b.first ]->getID ();
205+ });
206+
206207 } catch (const std::exception& e) {
207208 std::cerr << " ERROR during sorting: " << e.what () << ' \n ' ;
208209 }
209210
210211 for (const auto & [source_name, target_name] : connection_list) {
211- if (name_to_layer.count (source_name) && name_to_layer.count (target_name)) {
212+ if (name_to_layer.contains (source_name) &&
213+ name_to_layer.contains (target_name)) {
212214 if (target_name.find (" Concat" ) != std::string::npos ||
213215 name_to_layer[target_name]->getName () == it_lab_ai::kConcat ) {
214216 if (concat_connections.find (target_name) != concat_connections.end ()) {
@@ -532,7 +534,7 @@ ParseResult parse_json_model(RuntimeOptions options,
532534 std::string constant_name = inputs[1 ].get <std::string>();
533535 constant_name = get_base_layer_name (constant_name);
534536
535- if (layer_parameters.count (constant_name)) {
537+ if (layer_parameters.contains (constant_name)) {
536538 splits = layer_parameters[constant_name];
537539 } else if (constant_name.find (" onnx::" ) != std::string::npos) {
538540 splits = last_constant_value;
@@ -735,7 +737,7 @@ ParseResult parse_json_model(RuntimeOptions options,
735737 std::string constant_name = inputs[1 ].get <std::string>();
736738 constant_name = get_base_layer_name (constant_name);
737739
738- if (layer_parameters.count (constant_name)) {
740+ if (layer_parameters.contains (constant_name)) {
739741 shape = layer_parameters[constant_name];
740742 }
741743 }
@@ -797,7 +799,7 @@ ParseResult parse_json_model(RuntimeOptions options,
797799 std::string constant_name = inputs[1 ].get <std::string>();
798800 constant_name = get_base_layer_name (constant_name);
799801
800- if (layer_parameters.count (constant_name)) {
802+ if (layer_parameters.contains (constant_name)) {
801803 axes = layer_parameters[constant_name];
802804 } else if (constant_name.find (" onnx::" ) != std::string::npos) {
803805 axes = last_constant_value;
0 commit comments