From afb8496261d0abba4dee23f6d44daa801205cc3c Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Wed, 23 Aug 2023 11:46:30 -0700 Subject: [PATCH] Disable local symblol table. Local symblol tables mark unrelated shapes re-use and cause inference to error out. --- onnxruntime/core/graph/function_utils.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/onnxruntime/core/graph/function_utils.cc b/onnxruntime/core/graph/function_utils.cc index 4b7900194488d..aa0727e3750b0 100644 --- a/onnxruntime/core/graph/function_utils.cc +++ b/onnxruntime/core/graph/function_utils.cc @@ -344,10 +344,15 @@ std::unique_ptr CreateSchema(const std::string& functi std::unordered_map map_copy(model_local_functions.begin(), model_local_functions.end()); std::unordered_map empty_map; - ONNX_NAMESPACE::shape_inference::SymbolTableImpl symbolTable; + + // https://github.com/microsoft/onnxruntime/issues/17061 + // We are passing a nullptr for the symbol table, because symbol table must be global + // for all the shape inferencing to work correctly. Otherwise, unrelated shapes get + // the same symbolic shapes and are marked for memory re-use. This is a Temp fix. + constexpr ONNX_NAMESPACE::shape_inference::SymbolTableImpl* symbolTable = nullptr; ONNX_NAMESPACE::shape_inference::InferShapeForFunctionNode(*onnx_func_proto, func_domain_to_version, schema_registry, ctx, options, map_copy, - &symbolTable, &empty_map); + symbolTable, &empty_map); }); op_schema->Finalize();