From 6ca761ff55469b97c9733e0dc1324fae6750e028 Mon Sep 17 00:00:00 2001 From: Atanas Dimitrov Date: Thu, 8 Feb 2024 16:53:33 +0200 Subject: [PATCH] Simple draft for moving away the node verification. --- cmake/external/emsdk | 2 +- onnxruntime/core/graph/graph.cc | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cmake/external/emsdk b/cmake/external/emsdk index 4e2496141eda1..a896e3d066448 160000 --- a/cmake/external/emsdk +++ b/cmake/external/emsdk @@ -1 +1 @@ -Subproject commit 4e2496141eda15040c44e9bbf237a1326368e34c +Subproject commit a896e3d066448b3530dbcaa48869fafefd738f57 diff --git a/onnxruntime/core/graph/graph.cc b/onnxruntime/core/graph/graph.cc index f71b7ecebcf1a..f3889933096a1 100644 --- a/onnxruntime/core/graph/graph.cc +++ b/onnxruntime/core/graph/graph.cc @@ -1320,8 +1320,21 @@ Graph::Graph(const Model& owning_model, } } + CheckerContext ctx; + ctx.set_ir_version(gsl::narrow_cast(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_) {