diff --git a/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc b/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc index bdcb841c16bd2a44eaa632dac6099e877d8e698c..2e1e8cf876379e9c88850b8a800eca83d28799f9 100644 --- a/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc +++ b/paddle/fluid/framework/new_executor/interpreter/interpreter_util.cc @@ -94,8 +94,6 @@ static std::set OpsNeedSetOutputDtypeWhenRegisterPhiKernel = { "multiclass_nms3", "multinomial", "nanmedian", - "nms", - "nonzero", "numl", "qr", "qr_grad", diff --git a/paddle/phi/kernels/cpu/nms_kernel.cc b/paddle/phi/kernels/cpu/nms_kernel.cc index 6743f13fff7191f2b2245ea8b6291ab177f0e99c..cf663bd8346b6851034a85a220441df55dce3794 100644 --- a/paddle/phi/kernels/cpu/nms_kernel.cc +++ b/paddle/phi/kernels/cpu/nms_kernel.cc @@ -94,4 +94,6 @@ void NMSKernel(const Context& dev_ctx, } // namespace phi -PD_REGISTER_KERNEL(nms, CPU, ALL_LAYOUT, phi::NMSKernel, float, double) {} +PD_REGISTER_KERNEL(nms, CPU, ALL_LAYOUT, phi::NMSKernel, float, double) { + kernel->OutputAt(0).SetDataType(paddle::experimental::DataType::INT64); +} diff --git a/paddle/phi/kernels/cpu/nonzero_kernel.cc b/paddle/phi/kernels/cpu/nonzero_kernel.cc index fca8e6b09fc2897b5062bc4dc59dc02ea57092db..70b2a21230794f4230b932ad7a659af5958cf2b1 100644 --- a/paddle/phi/kernels/cpu/nonzero_kernel.cc +++ b/paddle/phi/kernels/cpu/nonzero_kernel.cc @@ -92,4 +92,6 @@ PD_REGISTER_KERNEL(nonzero, int16_t, bool, float, - double) {} + double) { + kernel->OutputAt(0).SetDataType(paddle::experimental::DataType::INT64); +} diff --git a/paddle/phi/kernels/gpu/nms_kernel.cu b/paddle/phi/kernels/gpu/nms_kernel.cu index c8b067444dfebe4a101797356ceabffe0607d0a1..017196973de57af7b626fcee6719cf461fc8f84e 100644 --- a/paddle/phi/kernels/gpu/nms_kernel.cu +++ b/paddle/phi/kernels/gpu/nms_kernel.cu @@ -113,4 +113,6 @@ void NMSKernel(const Context& dev_ctx, dev_ctx.stream()); } } // namespace phi -PD_REGISTER_KERNEL(nms, GPU, ALL_LAYOUT, phi::NMSKernel, float, double) {} +PD_REGISTER_KERNEL(nms, GPU, ALL_LAYOUT, phi::NMSKernel, float, double) { + kernel->OutputAt(0).SetDataType(paddle::experimental::DataType::INT64); +} diff --git a/paddle/phi/kernels/gpu/nonzero_kernel.cu b/paddle/phi/kernels/gpu/nonzero_kernel.cu index 11139c7d65ded27784a706e24b57ef5fca5d18b3..b4aab6fe6f8d274da07f854b580c84c0df0ad0a2 100644 --- a/paddle/phi/kernels/gpu/nonzero_kernel.cu +++ b/paddle/phi/kernels/gpu/nonzero_kernel.cu @@ -83,4 +83,6 @@ PD_REGISTER_KERNEL(nonzero, int16_t, bool, float, - double) {} + double) { + kernel->OutputAt(0).SetDataType(paddle::experimental::DataType::INT64); +} diff --git a/paddle/phi/kernels/xpu/nonzero_kernel.cc b/paddle/phi/kernels/xpu/nonzero_kernel.cc index 35d093c447547f338d065d5a03a6ba81c1b62a22..aa1e39a897c5e28259bf6f5e71fdd89eb34b8cee 100644 --- a/paddle/phi/kernels/xpu/nonzero_kernel.cc +++ b/paddle/phi/kernels/xpu/nonzero_kernel.cc @@ -69,4 +69,6 @@ void NonZeroKernel(const Context& dev_ctx, } // namespace phi PD_REGISTER_KERNEL( - nonzero, XPU, ALL_LAYOUT, phi::NonZeroKernel, int, bool, float) {} + nonzero, XPU, ALL_LAYOUT, phi::NonZeroKernel, int, bool, float) { + kernel->OutputAt(0).SetDataType(paddle::experimental::DataType::INT64); +}