From 0a190c88692bac1a8c7d52f84b8a0da281f89a9b Mon Sep 17 00:00:00 2001 From: 103yiran <1039105206@qq.com> Date: Wed, 24 Oct 2018 12:33:02 -0700 Subject: [PATCH] Move the location of annotation Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/12969 Differential Revision: D10560824 Pulled By: ezyang fbshipit-source-id: 86c21149682db5ebfd9610df9e9845688a3db3b0 --- modules/detectron/ps_roi_pool_op.cu | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/detectron/ps_roi_pool_op.cu b/modules/detectron/ps_roi_pool_op.cu index 53844b1aa04..2e713a786fc 100644 --- a/modules/detectron/ps_roi_pool_op.cu +++ b/modules/detectron/ps_roi_pool_op.cu @@ -130,6 +130,7 @@ __global__ void PSRoIPoolForward( T bin_size_h = roi_height / static_cast(pooled_height); T bin_size_w = roi_width / static_cast(pooled_width); + // Add roi offsets and clip to input boundaries int hstart = floor( static_cast(ph) * bin_size_h + roi_start_h); int wstart = floor( @@ -138,7 +139,7 @@ __global__ void PSRoIPoolForward( static_cast(ph + 1) * bin_size_h + roi_start_h); int wend = ceil( static_cast(pw + 1) * bin_size_w + roi_start_w); - // Add roi offsets and clip to input boundaries + hstart = min(max(hstart, 0), height); hend = min(max(hend, 0), height); wstart = min(max(wstart, 0),width);