From 1587ad07345b2d258fc150384610b0e7638f6e1f Mon Sep 17 00:00:00 2001 From: TTerror Date: Sat, 23 Apr 2022 13:22:31 +0800 Subject: [PATCH] update reduce_max for kunlun, *test=kunlun (#42116) --- paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc | 5 ++--- paddle/fluid/platform/device/xpu/xpu2_op_list.h | 3 +++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc b/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc index 15d672da04b..1c1269a08db 100644 --- a/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc +++ b/paddle/fluid/operators/reduce_ops/reduce_max_op_xpu.cc @@ -105,11 +105,10 @@ class ReduceMaxGradXPUKernel : public framework::OpKernel { " wrong value[%d %s].", r, XPUAPIErrorMsg[r])); // step 2. comparse out_brocast and x - r = xpu::elementwise_equal(dev_ctx.x_context(), x_data, brocast1, equal, - x->numel()); + r = xpu::equal(dev_ctx.x_context(), x_data, brocast1, equal, x->numel()); PADDLE_ENFORCE_EQ( r == xpu::Error_t::SUCCESS, true, - platform::errors::External("XPU elementwise_equal in reduce_max_grad " + platform::errors::External("XPU equal in reduce_max_grad " "op return wrong value[%d %s].", r, XPUAPIErrorMsg[r])); // step 3. get x_grad diff --git a/paddle/fluid/platform/device/xpu/xpu2_op_list.h b/paddle/fluid/platform/device/xpu/xpu2_op_list.h index 357644b62d3..583014b6f47 100644 --- a/paddle/fluid/platform/device/xpu/xpu2_op_list.h +++ b/paddle/fluid/platform/device/xpu/xpu2_op_list.h @@ -57,6 +57,9 @@ XPUOpMap& get_kl2_ops() { pOpKernelType(vartype::BOOL, XPUPlace()), pOpKernelType(vartype::INT64, XPUPlace()), pOpKernelType(vartype::INT32, XPUPlace())})}, + {"check_finite_and_unscale", + XPUKernelSet({pOpKernelType(vartype::FP32, XPUPlace()), + pOpKernelType(vartype::FP16, XPUPlace())})}, {"clip", XPUKernelSet({pOpKernelType(vartype::FP32, XPUPlace())})}, {"concat_grad", XPUKernelSet({pOpKernelType(vartype::FP32, XPUPlace()), pOpKernelType(vartype::FP16, XPUPlace())})}, -- GitLab