提交 5d7395cd 编写于 作者: W wanghaoshuang

Fix warning of roi perspective transform op.

上级 9e8d372f
...@@ -260,8 +260,8 @@ class CPUROIPerspectiveTransformOpKernel : public framework::OpKernel<T> { ...@@ -260,8 +260,8 @@ class CPUROIPerspectiveTransformOpKernel : public framework::OpKernel<T> {
roi2image.Resize({rois_num}); roi2image.Resize({rois_num});
int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace()); int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace());
auto lod = rois->lod().back(); auto lod = rois->lod().back();
for (int i = 0; i < lod.size() - 1; ++i) { for (size_t i = 0; i < lod.size() - 1; ++i) {
for (int j = lod[i]; j < lod[i + 1]; ++j) { for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
roi2image_data[j] = i; roi2image_data[j] = i;
} }
} }
...@@ -393,8 +393,8 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> { ...@@ -393,8 +393,8 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> {
roi2image.Resize({rois_num}); roi2image.Resize({rois_num});
int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace()); int* roi2image_data = roi2image.mutable_data<int>(ctx.GetPlace());
auto lod = rois->lod().back(); auto lod = rois->lod().back();
for (int i = 0; i < lod.size() - 1; ++i) { for (size_t i = 0; i < lod.size() - 1; ++i) {
for (int j = lod[i]; j < lod[i + 1]; ++j) { for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
roi2image_data[j] = i; roi2image_data[j] = i;
} }
} }
...@@ -404,7 +404,7 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> { ...@@ -404,7 +404,7 @@ class CPUROIPerspectiveTransformGradOpKernel : public framework::OpKernel<T> {
for (int in_h = 0; in_h < in_height; ++in_h) { for (int in_h = 0; in_h < in_height; ++in_h) {
for (int in_w = 0; in_w < in_width; ++in_w) { for (int in_w = 0; in_w < in_width; ++in_w) {
T gradient = 0.0; T gradient = 0.0;
for (int roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) { for (size_t roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
const T* rois = rois_data + roi_idx * 8; const T* rois = rois_data + roi_idx * 8;
T roi_x[4]; T roi_x[4];
T roi_y[4]; T roi_y[4];
......
...@@ -345,8 +345,8 @@ class CUDAROIPerspectiveTransformOpKernel : public framework::OpKernel<T> { ...@@ -345,8 +345,8 @@ class CUDAROIPerspectiveTransformOpKernel : public framework::OpKernel<T> {
roi2image.Resize({rois_num}); roi2image.Resize({rois_num});
int* roi2image_data = roi2image.mutable_data<int>(platform::CPUPlace()); int* roi2image_data = roi2image.mutable_data<int>(platform::CPUPlace());
auto lod = rois->lod().back(); auto lod = rois->lod().back();
for (int i = 0; i < lod.size() - 1; ++i) { for (size_t i = 0; i < lod.size() - 1; ++i) {
for (int j = lod[i]; j < lod[i + 1]; ++j) { for (size_t j = lod[i]; j < lod[i + 1]; ++j) {
roi2image_data[j] = i; roi2image_data[j] = i;
} }
} }
...@@ -432,7 +432,7 @@ __global__ void RoiTransformGradKernel( ...@@ -432,7 +432,7 @@ __global__ void RoiTransformGradKernel(
T gradient = 0.0; T gradient = 0.0;
// Accumulate gradient over all RoIs that interpolated this element // Accumulate gradient over all RoIs that interpolated this element
for (int roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) { for (size_t roi_idx = lod[n]; roi_idx < lod[n + 1]; ++roi_idx) {
const T* rois = rois_data + roi_idx * 8; const T* rois = rois_data + roi_idx * 8;
T roi_x[4]; T roi_x[4];
T roi_y[4]; T roi_y[4];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册