Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
MMCV
Commits
f6fd6c21
Commit
f6fd6c21
authored
Aug 18, 2022
by
Jingwei Zhang
Committed by
Zaida Zhou
Aug 18, 2022
Browse files
[Fix] Fix a potential bug in prroipool op (#2200)
parent
86f9dc7a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
mmcv/ops/csrc/common/cuda/prroi_pool_cuda_kernel.cuh
mmcv/ops/csrc/common/cuda/prroi_pool_cuda_kernel.cuh
+13
-13
No files found.
mmcv/ops/csrc/common/cuda/prroi_pool_cuda_kernel.cuh
View file @
f6fd6c21
...
@@ -223,13 +223,13 @@ __global__ void prroi_pool_backward_cuda_kernel(
...
@@ -223,13 +223,13 @@ __global__ void prroi_pool_backward_cuda_kernel(
int
ph
=
(
index
/
pooled_width
)
%
pooled_height
;
int
ph
=
(
index
/
pooled_width
)
%
pooled_height
;
int
c
=
(
index
/
pooled_width
/
pooled_height
)
%
channels
;
int
c
=
(
index
/
pooled_width
/
pooled_height
)
%
channels
;
int
n
=
index
/
pooled_width
/
pooled_height
/
channels
;
int
n
=
index
/
pooled_width
/
pooled_height
/
channels
;
rois
+
=
n
*
5
;
auto
rois_cur
=
rois
+
n
*
5
;
int
roi_batch_ind
=
rois
[
0
];
int
roi_batch_ind
=
rois
_cur
[
0
];
T
roi_x1
=
rois
[
1
]
*
spatial_scale
;
T
roi_x1
=
rois
_cur
[
1
]
*
spatial_scale
;
T
roi_y1
=
rois
[
2
]
*
spatial_scale
;
T
roi_y1
=
rois
_cur
[
2
]
*
spatial_scale
;
T
roi_x2
=
rois
[
3
]
*
spatial_scale
;
T
roi_x2
=
rois
_cur
[
3
]
*
spatial_scale
;
T
roi_y2
=
rois
[
4
]
*
spatial_scale
;
T
roi_y2
=
rois
_cur
[
4
]
*
spatial_scale
;
T
roi_width
=
max
(
roi_x2
-
roi_x1
,
(
T
)
0
);
T
roi_width
=
max
(
roi_x2
-
roi_x1
,
(
T
)
0
);
T
roi_height
=
max
(
roi_y2
-
roi_y1
,
(
T
)
0
);
T
roi_height
=
max
(
roi_y2
-
roi_y1
,
(
T
)
0
);
...
@@ -278,13 +278,13 @@ __global__ void prroi_pool_coor_backward_cuda_kernel(
...
@@ -278,13 +278,13 @@ __global__ void prroi_pool_coor_backward_cuda_kernel(
int
ph
=
(
index
/
pooled_width
)
%
pooled_height
;
int
ph
=
(
index
/
pooled_width
)
%
pooled_height
;
int
c
=
(
index
/
pooled_width
/
pooled_height
)
%
channels
;
int
c
=
(
index
/
pooled_width
/
pooled_height
)
%
channels
;
int
n
=
index
/
pooled_width
/
pooled_height
/
channels
;
int
n
=
index
/
pooled_width
/
pooled_height
/
channels
;
rois
+
=
n
*
5
;
auto
rois_cur
=
rois
+
n
*
5
;
int
roi_batch_ind
=
rois
[
0
];
int
roi_batch_ind
=
rois
_cur
[
0
];
T
roi_x1
=
rois
[
1
]
*
spatial_scale
;
T
roi_x1
=
rois
_cur
[
1
]
*
spatial_scale
;
T
roi_y1
=
rois
[
2
]
*
spatial_scale
;
T
roi_y1
=
rois
_cur
[
2
]
*
spatial_scale
;
T
roi_x2
=
rois
[
3
]
*
spatial_scale
;
T
roi_x2
=
rois
_cur
[
3
]
*
spatial_scale
;
T
roi_y2
=
rois
[
4
]
*
spatial_scale
;
T
roi_y2
=
rois
_cur
[
4
]
*
spatial_scale
;
T
roi_width
=
max
(
roi_x2
-
roi_x1
,
(
T
)
0
);
T
roi_width
=
max
(
roi_x2
-
roi_x1
,
(
T
)
0
);
T
roi_height
=
max
(
roi_y2
-
roi_y1
,
(
T
)
0
);
T
roi_height
=
max
(
roi_y2
-
roi_y1
,
(
T
)
0
);
...
@@ -307,7 +307,7 @@ __global__ void prroi_pool_coor_backward_cuda_kernel(
...
@@ -307,7 +307,7 @@ __global__ void prroi_pool_coor_backward_cuda_kernel(
T
sum_out
=
bin_size
==
T
(
0
)
?
T
(
0
)
:
output_grad_val
/
bin_size
;
T
sum_out
=
bin_size
==
T
(
0
)
?
T
(
0
)
:
output_grad_val
/
bin_size
;
// WARNING: to be discussed
// WARNING: to be discussed
if
(
sum_out
==
0
)
return
;
if
(
sum_out
==
0
)
continue
;
int
start_x
,
start_y
,
end_x
,
end_y
;
int
start_x
,
start_y
,
end_x
,
end_y
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment