diff --git a/paddle/fluid/operators/roi_align_op_npu.cc b/paddle/fluid/operators/roi_align_op_npu.cc index 0d01771d9d6c0d882cea685ed7d95113850ac270..f14e29f8ddc278dc2408dbfc1d1f60002d286442 100644 --- a/paddle/fluid/operators/roi_align_op_npu.cc +++ b/paddle/fluid/operators/roi_align_op_npu.cc @@ -157,8 +157,10 @@ class ROIAlignNPUGradKernel : public framework::OpKernel { "ConcatD", {x_list}, {ROIs_N5}, {{"N", 2}, {"concat_dim", 1}}); runner_concat.Run(stream); - // By analysis, in order to match cpu grad version, - // rois[:,3:5] should substrate 1 before call ascend grad function + // If CANN version code is less than 504, by analysis, in order to match + // cpu grad version, rois[:,3:5] should substrate 1 before call ascend grad + // function +#if (CANN_VERSION_CODE < 504000) std::vector vec_dlt = {0, 0, 0, -1.0f, -1.0f}; Tensor tsr_dlt; tsr_dlt.mutable_data({5}, place); @@ -167,6 +169,7 @@ class ROIAlignNPUGradKernel : public framework::OpKernel { const auto& runner_add = NpuOpRunner("AddV2", {ROIs_N5, tsr_dlt}, {ROIs_N5}, {}); runner_add.Run(stream); +#endif // Call ascend RoiAlignGrad function int roi_end_mode = 0;