Skip to content

Commit

Permalink
fix bug of elementwise_add_grad, *test=kunlun (#44545)
Browse files Browse the repository at this point in the history
* fix bug of elementwise_add_grad, *test=kunlun

* fix bug, *test=kunlun

* rm pooling_t, *test=kunlun

* fix bug of ew_add_grad when inplace, *test=kunlun
  • Loading branch information
helen88 authored Jul 27, 2022
1 parent 963163e commit 35ca1ce
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
4 changes: 2 additions & 2 deletions cmake/external/xpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ set(XPU_RT_LIB_NAME "libxpurt.so")
if(NOT DEFINED XPU_BASE_URL)
set(XPU_BASE_URL_WITHOUT_DATE
"https://baidu-kunlun-product.cdn.bcebos.com/KL-SDK/klsdk-dev")
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220719")
set(XPU_BASE_URL "${XPU_BASE_URL_WITHOUT_DATE}/20220722")
else()
set(XPU_BASE_URL "${XPU_BASE_URL}")
endif()
Expand All @@ -19,7 +19,7 @@ endif()
if(NOT DEFINED XPU_XDNN_BASE_URL)
set(XPU_XDNN_BASE_URL_WITHOUT_DATE
"https://klx-sdk-release-public.su.bcebos.com/xdnn/dev")
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220719")
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL_WITHOUT_DATE}/20220722")
else()
set(XPU_XDNN_BASE_URL "${XPU_XDNN_BASE_URL}")
endif()
Expand Down
7 changes: 2 additions & 5 deletions paddle/fluid/operators/elementwise/elementwise_add_op_xpu.cc
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
/* Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
/* Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -74,7 +71,7 @@ class ElementwiseAddGradXPUKernel : public ElemwiseGradKernel<T> {
int ret =
xpu::reduce_sum<XPUType>(dev_ctx.x_context(),
reinterpret_cast<const XPUType*>(dz_data),
reinterpret_cast<XPUType*>(dx_data),
reinterpret_cast<XPUType*>(dx->data<T>()),
dz_vector,
reduce_dims);
PADDLE_ENFORCE_XDNN_SUCCESS(ret, "reduce_sum");
Expand Down
17 changes: 0 additions & 17 deletions paddle/fluid/operators/pool_op_xpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,6 @@ namespace operators {

using framework::Tensor;

xpu::Pooling_t XPUPoolingType(const std::string& pooltype,
bool exclusive,
bool is_test) {
if (pooltype == "max") {
return xpu::Pooling_t::MAX_WITHOUT_INDEX;
} else if (pooltype == "avg") {
if (exclusive) {
return xpu::Pooling_t::AVG_WITHOUT_PAD;
} else {
return xpu::Pooling_t::AVG_WITH_PAD;
}
} else {
PADDLE_THROW(platform::errors::InvalidArgument(
"Pool op only supports 2D and 3D input."));
}
}

template <typename DeviceContext, typename T>
class PoolXPUKernel : public framework::OpKernel<T> {
using XPUType = typename XPUTypeTrait<T>::Type;
Expand Down

0 comments on commit 35ca1ce

Please sign in to comment.