!19501 [MSLITE][DEVELOP] fix bug of delegate resize

Merge pull request !19501 from yangruoqi713/delegate_1
This commit is contained in:
i-robot 2021-07-07 03:34:01 +00:00 committed by Gitee
commit 25ee89cf30
1 changed files with 11 additions and 11 deletions

View File

@ -822,19 +822,19 @@ int LiteSession::ReSizeKernels(const std::vector<kernel::LiteKernel *> &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::OpenCLSubGraph *>(kernel);
ret = sub_graph->ReSize(false);
#endif
if (kernel->desc().delegate != nullptr) {
ret = kernel->ReSize();
} else {
auto sub_graph = reinterpret_cast<kernel::SubGraphKernel *>(kernel);
ret = sub_graph->ReSize();
if (kernel->subgraph_type() == kernel::kGpuSubGraph) {
#if GPU_OPENCL
auto sub_graph = reinterpret_cast<kernel::OpenCLSubGraph *>(kernel);
ret = sub_graph->ReSize(false);
#endif
} else {
auto sub_graph = reinterpret_cast<kernel::SubGraphKernel *>(kernel);
ret = sub_graph->ReSize();
}
}
if (ret == RET_INFER_INVALID) {
MS_LOG(INFO) << "InferShape is interrupted";