diff --git a/onnxruntime/core/graph/function_utils.cc b/onnxruntime/core/graph/function_utils.cc index 7a851799454b0..eb9bc9c4440ef 100644 --- a/onnxruntime/core/graph/function_utils.cc +++ b/onnxruntime/core/graph/function_utils.cc @@ -1,5 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#include +#include #include #include "core/graph/function_utils.h" @@ -15,6 +17,33 @@ namespace function_utils { using string = std::string; using namespace ONNX_NAMESPACE; +namespace { + +bool AttributeContainsSubgraphs(const AttributeProto& attr) { + return attr.has_g() || attr.graphs_size() > 0; +} + +std::string FormatAttributeReferenceChain(const std::vector& active_attr_refs, const std::string& next_attr_ref) { + std::ostringstream stream; + + for (size_t i = 0; i < active_attr_refs.size(); ++i) { + if (i != 0) { + stream << " -> "; + } + + stream << active_attr_refs[i]; + } + + if (!active_attr_refs.empty()) { + stream << " -> "; + } + + stream << next_attr_ref; + return stream.str(); +} + +} // namespace + // Utilify function to get the imported version of domain from opset imports // Returns -1 if requested domain is not found in the opset_imports template