From 3cd448e05a058302711b4530ef759a9efb2d4841 Mon Sep 17 00:00:00 2001 From: Changming Sun Date: Thu, 7 Mar 2019 14:03:24 -0800 Subject: [PATCH] Fix: IExecutionProvider::GetCapability returns redundant subgraphs --- onnxruntime/core/framework/execution_provider.cc | 1 + onnxruntime/core/providers/cuda/cuda_execution_provider.cc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/onnxruntime/core/framework/execution_provider.cc b/onnxruntime/core/framework/execution_provider.cc index 54cbb77e85..d773bc89c1 100644 --- a/onnxruntime/core/framework/execution_provider.cc +++ b/onnxruntime/core/framework/execution_provider.cc @@ -35,6 +35,7 @@ IExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph, std::unique_ptr sub_graph = std::make_unique(); sub_graph->nodes.push_back(node.Index()); result.push_back(std::make_unique(std::move(sub_graph))); + break; } } } diff --git a/onnxruntime/core/providers/cuda/cuda_execution_provider.cc b/onnxruntime/core/providers/cuda/cuda_execution_provider.cc index cc03f1362e..0cb021a976 100644 --- a/onnxruntime/core/providers/cuda/cuda_execution_provider.cc +++ b/onnxruntime/core/providers/cuda/cuda_execution_provider.cc @@ -864,7 +864,6 @@ bool CUDAExecutionProvider::ConvNeedFallbackToCPU(const onnxruntime::Node& node) std::vector> CUDAExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph, const std::vector& kernel_registries) const { - std::vector> result = IExecutionProvider::GetCapability(graph, kernel_registries); for (auto& node : graph.Nodes()) { bool fallback_to_cpu_provider = false; @@ -888,6 +887,7 @@ CUDAExecutionProvider::GetCapability(const onnxruntime::GraphViewer& graph, update_node->SetExecutionProviderType(onnxruntime::kCpuExecutionProvider); } } + std::vector> result = IExecutionProvider::GetCapability(graph, kernel_registries); return result; }