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
vision
Commits
175716bd
Unverified
Commit
175716bd
authored
Oct 26, 2021
by
David Fan
Committed by
GitHub
Oct 26, 2021
Browse files
RoiAlign aligned=True (#4692)
Co-authored-by:
Prabhat Roy
<
prabhatroy@fb.com
>
parent
29aa38ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
torchvision/ops/_register_onnx_ops.py
torchvision/ops/_register_onnx_ops.py
+5
-4
No files found.
torchvision/ops/_register_onnx_ops.py
View file @
175716bd
...
...
@@ -26,13 +26,14 @@ def _register_custom_op():
g
,
squeeze
(
g
,
select
(
g
,
rois
,
1
,
g
.
op
(
"Constant"
,
value_t
=
torch
.
tensor
([
0
],
dtype
=
torch
.
long
))),
1
),
False
)
rois
=
select
(
g
,
rois
,
1
,
g
.
op
(
"Constant"
,
value_t
=
torch
.
tensor
([
1
,
2
,
3
,
4
],
dtype
=
torch
.
long
)))
# TODO: Remove this warning after ONNX opset 16 is supported.
if
aligned
:
warnings
.
warn
(
"ONNX export of ROIAlign with aligned=True does not match PyTorch when using malformed boxes,"
" ONNX forces ROIs to be 1x1 or larger."
"ROIAlign with aligned=True is not supported in ONNX, but will be supported in opset 16. "
"The workaround is that the user need apply the patch "
"https://github.com/microsoft/onnxruntime/pull/8564 "
"and build ONNXRuntime from source."
)
scale
=
torch
.
tensor
(
0.5
/
spatial_scale
).
to
(
dtype
=
torch
.
float
)
rois
=
g
.
op
(
"Sub"
,
rois
,
scale
)
# ONNX doesn't support negative sampling_ratio
if
sampling_ratio
<
0
:
...
...
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