From 4e05ea29439fbb9e9ff0611ada1b2b1afdd7debd Mon Sep 17 00:00:00 2001 From: zhupengyang Date: Tue, 22 Oct 2019 14:19:47 +0800 Subject: [PATCH] remove feed and fetch for npu subgraph pass (#2230) test=develop --- lite/core/mir/subgraph/subgraph_program_pass.cc | 2 ++ lite/core/optimizer.h | 14 -------------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/lite/core/mir/subgraph/subgraph_program_pass.cc b/lite/core/mir/subgraph/subgraph_program_pass.cc index 3c7f027fdf..31c28ad89c 100644 --- a/lite/core/mir/subgraph/subgraph_program_pass.cc +++ b/lite/core/mir/subgraph/subgraph_program_pass.cc @@ -207,6 +207,8 @@ void SubgraphProgramPass::InferOnce(const std::unique_ptr& graph) { if (!item->IsStmt()) continue; auto& stmt = item->AsStmt(); auto& op = stmt.op(); + std::string op_type = op->op_info()->Type(); + if (op_type == "feed" || op_type == "fetch") continue; op->CheckShape(); op->InferShape(); // TOOD(xxx): remove Launch() at last diff --git a/lite/core/optimizer.h b/lite/core/optimizer.h index 37deddb346..93d8a148c9 100644 --- a/lite/core/optimizer.h +++ b/lite/core/optimizer.h @@ -126,7 +126,6 @@ class Optimizer { valid_places_.end(), Place{TARGET(kNPU), PRECISION(kFloat)}) != valid_places_.end()) { - CheckInputDimsNotEmpty(exec_scope_); auto pass = mir::PassManager::Global() .LookUp( "generate_npu_program_pass"); @@ -150,19 +149,6 @@ class Optimizer { return program; } - // check the input dims in the scope, must not be empty - void CheckInputDimsNotEmpty(const lite::Scope* scope) { - CHECK(scope); - auto* feed_var = scope->FindVar("feed"); - CHECK(feed_var) << "no feed variable in exec_scope: " << scope; - auto* feed_tensor_list = feed_var->GetMutable>(); - CHECK_GE(feed_tensor_list->size(), 1); - for (size_t i = 0; i < feed_tensor_list->size(); ++i) { - CHECK(!feed_tensor_list->at(i).dims().empty()) - << "Input " << i << " dims can not be empty."; - } - } - void InitTargetTypeTransformPass() { auto* pass = mir::PassManager::Global().LookUp( -- GitLab