Skip to content

Commit

Permalink
Move some of the Node verification in the constructor of Graph
Browse files Browse the repository at this point in the history
  • Loading branch information
Atanas Dimitrov committed Feb 8, 2024
1 parent f3402de commit e1467c7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion onnxruntime/core/graph/graph.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1320,8 +1320,21 @@ Graph::Graph(const Model& owning_model,
}
}

CheckerContext ctx;
ctx.set_ir_version(gsl::narrow_cast<int>(IrVersion()));
ctx.set_opset_imports(DomainToVersionMap());
ctx.set_schema_registry(schema_registry_.get());
ctx.set_model_dir(ToUTF8String(ModelPath().ParentPath().ToPathString()));

LexicalScopeContext lsc;

for (const auto& node_proto : graph_proto_->node()) {
AddNode(node_proto, name_to_type_map);
auto& node = AddNode(node_proto, name_to_type_map);
ORT_TRY {
checker::check_node(node_proto, ctx, lsc);
SetOpSchemaFromRegistryForNode(node);
}
ORT_CATCH(const std::exception& ex) {}
}

if (is_loaded_from_model_file_) {
Expand Down

0 comments on commit e1467c7

Please sign in to comment.