未验证 提交 a9ac608f 编写于 作者: Z zhangyikun02 提交者: GitHub

fix bug of abs_grad in eager mode for kunlun, test=kunlun (#47164)

上级 f1b8f0ef
......@@ -19,8 +19,6 @@
param : [x]
kernel :
func : abs_grad
data_transform:
skip_transform : out_grad
backward : abs_double_grad
- backward_op : acos_grad
......
......@@ -13,6 +13,7 @@
// limitations under the License.
#include "paddle/phi/common/complex.h"
#include "paddle/phi/common/type_traits.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/funcs/complex_functors.h"
#include "paddle/phi/kernels/impl/abs_grad_kernel_impl.h"
......@@ -28,7 +29,9 @@ PD_REGISTER_KERNEL(abs_grad,
int,
int64_t,
complex<float>,
complex<double>) {}
complex<double>) {
kernel->InputAt(1).SetDataType(phi::dtype::ToReal(kernel_key.dtype()));
}
PD_REGISTER_KERNEL(abs_double_grad,
CPU,
ALL_LAYOUT,
......
......@@ -16,6 +16,7 @@
#include "paddle/phi/common/complex.h"
#include "paddle/phi/common/float16.h"
#include "paddle/phi/common/type_traits.h"
#include "paddle/phi/core/kernel_registry.h"
#include "paddle/phi/kernels/impl/abs_grad_kernel_impl.h"
......@@ -31,7 +32,9 @@ PD_REGISTER_KERNEL(abs_grad,
int64_t,
phi::dtype::float16,
complex<float>,
complex<double>) {}
complex<double>) {
kernel->InputAt(1).SetDataType(phi::dtype::ToReal(kernel_key.dtype()));
}
PD_REGISTER_KERNEL(abs_double_grad,
GPU,
ALL_LAYOUT,
......
......@@ -15,6 +15,7 @@
#include "paddle/phi/kernels/abs_grad_kernel.h"
#include "paddle/phi/backends/xpu/enforce_xpu.h"
#include "paddle/phi/common/type_traits.h"
#include "paddle/phi/core/kernel_registry.h"
namespace phi {
......@@ -35,4 +36,6 @@ void AbsGradKernel(const Context& ctx,
}
} // namespace phi
PD_REGISTER_KERNEL(abs_grad, XPU, ALL_LAYOUT, phi::AbsGradKernel, float) {}
PD_REGISTER_KERNEL(abs_grad, XPU, ALL_LAYOUT, phi::AbsGradKernel, float) {
kernel->InputAt(1).SetDataType(phi::dtype::ToReal(kernel_key.dtype()));
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册