Skip to content

Commit 45530c7

Browse files
committed
Fix GPU compile
1 parent 7c42e5d commit 45530c7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

paddle/fluid/operators/random_crop_op.cu

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
#include "paddle/fluid/operators/random_crop_op.h"
1616

17+
namespace ops = paddle::operators;
1718
template <typename T>
1819
using Kernel = ops::RandomCropKernel<paddle::platform::CUDADeviceContext, T>;
1920
REGISTER_OP_CUDA_KERNEL(random_crop, Kernel<float>, Kernel<int>, Kernel<double>,

paddle/fluid/operators/random_crop_op.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ HOSTDEVICE inline void StridedMemcpy(const T* x, const size_t* x_dims, T* out,
6060
size_t offset_i = offsets[i];
6161

6262
if (i == rank - 1) {
63-
PADDLE_ENFORCE(x_stride == 1 && out_stride == 1);
63+
PADDLE_ASSERT(x_stride == 1 && out_stride == 1);
6464
x += offset_i;
6565
for (size_t j = 0; j < out_dim_i; ++j) {
6666
*out++ = *x++;
@@ -105,12 +105,12 @@ struct RandomCropFunctor {
105105
prod_batchsize_dims_ = 1;
106106
prod_x_ins_dims_ = 1;
107107
prod_out_ins_dims_ = 1;
108-
for (size_t i = 0; i < rank_; ++i) {
108+
for (size_t i = 0; i < static_cast<size_t>(rank_); ++i) {
109109
size_t x_dim_i = x_dims[i];
110110
size_t out_dim_i = out_dims[i];
111111
x_dims_[i] = x_dim_i;
112112
out_dims_[i] = out_dim_i;
113-
if (i < num_batchsize_dims_) {
113+
if (i < static_cast<size_t>(num_batchsize_dims_)) {
114114
PADDLE_ENFORCE_EQ(x_dim_i, out_dim_i);
115115
prod_batchsize_dims_ *= x_dim_i;
116116
} else {

0 commit comments

Comments
 (0)