From c16421c2594dc91782f94aeba826758b3d63a0f4 Mon Sep 17 00:00:00 2001 From: Qi Li Date: Fri, 6 Aug 2021 13:36:19 +0800 Subject: [PATCH] fix npu compile error, test=develop (#34656) --- paddle/fluid/framework/ir/CMakeLists.txt | 2 +- paddle/fluid/operators/expand_op_npu.cc | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/framework/ir/CMakeLists.txt b/paddle/fluid/framework/ir/CMakeLists.txt index 0107f597649..384f80395c7 100644 --- a/paddle/fluid/framework/ir/CMakeLists.txt +++ b/paddle/fluid/framework/ir/CMakeLists.txt @@ -59,7 +59,7 @@ cc_library(coalesce_grad_tensor_pass SRCS coalesce_grad_tensor_pass.cc DEPS grap pass_library(graph_to_program_pass base) pass_library(graph_viz_pass base) -pass_library(lock_free_optimize_pass base) +pass_library(lock_free_optimize_pass base DEPS string_helper) pass_library(fc_fuse_pass inference) pass_library(map_matmul_to_mul_pass inference) pass_library(attention_lstm_fuse_pass inference) diff --git a/paddle/fluid/operators/expand_op_npu.cc b/paddle/fluid/operators/expand_op_npu.cc index 76d5a203f30..2f66316c483 100644 --- a/paddle/fluid/operators/expand_op_npu.cc +++ b/paddle/fluid/operators/expand_op_npu.cc @@ -39,7 +39,26 @@ class ExpandNPUKernel : public framework::OpKernel { "The number of dimensions of the input 'x' for Op(expand) " "must be less than or equal to %d, but the value received is %d.", MAX_RANK_SUPPORTED, rank)); - switch (rank) { REP_EXPAND_TEMPLATE(MAX_RANK_SUPPORTED) } + switch (rank) { + case 1: + Expand<1>(context); + break; + case 2: + Expand<2>(context); + break; + case 3: + Expand<3>(context); + break; + case 4: + Expand<4>(context); + break; + case 5: + Expand<5>(context); + break; + case 6: + Expand<6>(context); + break; + } } protected: -- GitLab