From f5a4a9dcb074dbf6e8eb2bbdcbca719b18c3916e Mon Sep 17 00:00:00 2001 From: yangruoqi713 Date: Tue, 6 Jul 2021 20:55:40 +0800 Subject: [PATCH] [MSLITE][DEVELOP] fix bug of delegate resize --- mindspore/lite/src/lite_session.cc | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mindspore/lite/src/lite_session.cc b/mindspore/lite/src/lite_session.cc index 4911a819b12..b0973aa380a 100644 --- a/mindspore/lite/src/lite_session.cc +++ b/mindspore/lite/src/lite_session.cc @@ -822,19 +822,19 @@ int LiteSession::ReSizeKernels(const std::vector &kernels) MS_LOG(ERROR) << "input kernel is nullptr!"; return RET_ERROR; } - if (kernel->subgraph_type() == kernel::kNotSubGraph) { - MS_LOG(ERROR) << "All node in graph should be sub_graph"; - return RET_ERROR; - } auto ret = RET_OK; - if (kernel->subgraph_type() == kernel::kGpuSubGraph) { -#if GPU_OPENCL - auto sub_graph = reinterpret_cast(kernel); - ret = sub_graph->ReSize(false); -#endif + if (kernel->desc().delegate != nullptr) { + ret = kernel->ReSize(); } else { - auto sub_graph = reinterpret_cast(kernel); - ret = sub_graph->ReSize(); + if (kernel->subgraph_type() == kernel::kGpuSubGraph) { +#if GPU_OPENCL + auto sub_graph = reinterpret_cast(kernel); + ret = sub_graph->ReSize(false); +#endif + } else { + auto sub_graph = reinterpret_cast(kernel); + ret = sub_graph->ReSize(); + } } if (ret == RET_INFER_INVALID) { MS_LOG(INFO) << "InferShape is interrupted";