未验证 提交 35ca1ce4 编写于 作者: z8hanghuan's avatar z8hanghuan 提交者: GitHub

fix bug of elementwise_add_grad, *test=kunlun (#44545)

* 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
上级 963163e6
......@@ -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()
......@@ -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()
......
/* 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.
......@@ -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");
......
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册