Skip to content

Commit 5d7395c

Browse files
committed
Fix warning of roi perspective transform op.
1 parent 9e8d372 commit 5d7395c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

paddle/fluid/operators/detection/roi_perspective_transform_op.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ class CPUROIPerspectiveTransformOpKernel : public framework::OpKernel<T> {
260260
roi2image.Resize({rois_num});
261261
int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace());
262262
auto lod = rois->lod().back();
263-
for (int i = 0; i < lod.size() - 1; ++i) {
264-
for (int j = lod[i]; j < lod[i + 1]; ++j) {
263+
for (size_t i = 0; i < lod.size() - 1; ++i) {
264+
for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
265265
roi2image_data[j] = i;
266266
}
267267
}
@@ -393,8 +393,8 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> {
393393
roi2image.Resize({rois_num});
394394
int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace());
395395
auto lod = rois->lod().back();
396-
for (int i = 0; i < lod.size() - 1; ++i) {
397-
for (int j = lod[i]; j < lod[i + 1]; ++j) {
396+
for (size_t i = 0; i < lod.size() - 1; ++i) {
397+
for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
398398
roi2image_data[j] = i;
399399
}
400400
}
@@ -404,7 +404,7 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> {
404404
for (int in_h = 0; in_h < in_height; ++in_h) {
405405
for (int in_w = 0; in_w < in_width; ++in_w) {
406406
T gradient = 0.0;
407-
for (int roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
407+
for (size_t roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
408408
const T* rois = rois_data + roi_idx * 8;
409409
T roi_x[4];
410410
T roi_y[4];

paddle/fluid/operators/detection/roi_perspective_transform_op.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,8 @@ class CUDAROIPerspectiveTransformOpKernel : public framework::OpKernel<T> {
345345
roi2image.Resize({rois_num});
346346
int* roi2image_data = roi2image.mutable_data<int>(platform::CPUPlace());
347347
auto lod = rois->lod().back();
348-
for (int i = 0; i < lod.size() - 1; ++i) {
349-
for (int j = lod[i]; j < lod[i + 1]; ++j) {
348+
for (size_t i = 0; i < lod.size() - 1; ++i) {
349+
for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
350350
roi2image_data[j] = i;
351351
}
352352
}
@@ -432,7 +432,7 @@ __global__ void RoiTransformGradKernel(
432432

433433
T gradient = 0.0;
434434
// Accumulate gradient over all RoIs that interpolated this element
435-
for (int roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
435+
for (size_t roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
436436
const T* rois = rois_data + roi_idx * 8;
437437
T roi_x[4];
438438
T roi_y[4];

0 commit comments

Comments
 (0)