diff --git a/paddle/fluid/operators/detection/roi_perspective_transform_op.cu b/paddle/fluid/operators/detection/roi_perspective_transform_op.cu index 74c8384e1e7cbb94492763ba08effff49663cd5b..85eb0c45e06df39309d4a10218f2c1649a369d1a 100644 --- a/paddle/fluid/operators/detection/roi_perspective_transform_op.cu +++ b/paddle/fluid/operators/detection/roi_perspective_transform_op.cu @@ -466,6 +466,10 @@ class CUDAROIPerspectiveTransformGradOpKernel : public framework::OpKernel { auto* in_grad = ctx.Output(framework::GradVarName("X")); T* in_grad_data = in_grad->mutable_data(ctx.GetPlace()); + + math::SetConstant set_zero; + set_zero(ctx.cuda_device_context(), in_grad, static_cast(0)); + const T* out_grad_data = out_grad->data(); const int* out2in_idx_data = out2in_idx->data(); const T* out2in_w_data = out2in_w->data();