diff --git a/paddle/fluid/operators/grid_sampler_op.h b/paddle/fluid/operators/grid_sampler_op.h index d8556f3a7bb2e..da386052c7dc0 100644 --- a/paddle/fluid/operators/grid_sampler_op.h +++ b/paddle/fluid/operators/grid_sampler_op.h @@ -83,7 +83,7 @@ static inline void clip(const platform::CPUDeviceContext& ctx, auto extra = grid_abs - (grid_abs / double_range).floor() * double_range; grid_slice_t.device(place) = extra.cwiseMin(double_range - extra); if (max_val == 0) { - grid_slice_t.device(place) = grid_slice_t.constant(static_cast(0)); + grid_slice_t.device(place) = grid_slice_t.constant(static_cast(0)); } } else { auto double_range = static_cast((max_val + 1) * 2); @@ -132,7 +132,7 @@ static inline void clipWithMask(const platform::CPUDeviceContext& ctx, (is_neg != one_more_flip).template cast()); grid_slice_t.device(place) = extra.cwiseMin(double_range - extra); if (max_val == 0) { - grid_slice_t.device(place) = grid_slice_t.constant(static_cast(0)); + grid_slice_t.device(place) = grid_slice_t.constant(static_cast(0)); } } else { auto double_range = static_cast((max_val + 1) * 2);