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
3fb88b3e
Unverified
Commit
3fb88b3e
authored
Oct 23, 2023
by
Nicolas Hug
Committed by
GitHub
Oct 23, 2023
Browse files
Add opchecks for RoiAlign (#8057)
parent
68161e98
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
1 deletion
+25
-1
test/optests_failures_dict.json
test/optests_failures_dict.json
+12
-1
test/test_ops.py
test/test_ops.py
+13
-0
No files found.
test/optests_failures_dict.json
View file @
3fb88b3e
{
"_description"
:
"This is a dict containing failures for tests autogenerated by generate_opcheck_tests. For more details, please see https://docs.google.com/document/d/1Pj5HRZvdOq3xpFpbEjUZp2hBovhy7Wnxw14m6lF2154/edit"
,
"_version"
:
1
,
"data"
:
{}
"data"
:
{
"torchvision::roi_align"
:
{
"TestRoIAlign.test_aot_dispatch_dynamic__test_mps_error_inputs"
:
{
"comment"
:
"RuntimeError: MPS does not support roi_align backward with float16 inputs"
,
"status"
:
"xfail"
},
"TestRoIAlign.test_autograd_registration__test_mps_error_inputs"
:
{
"comment"
:
"NotImplementedError: autograd_registration_check: NYI devices other than CPU/CUDA, got {'mps'}"
,
"status"
:
"xfail"
}
}
}
}
test/test_ops.py
View file @
3fb88b3e
...
...
@@ -474,6 +474,7 @@ class TestRoIAlign(RoIOpTester):
@
pytest
.
mark
.
parametrize
(
"x_dtype"
,
(
torch
.
float16
,
torch
.
float32
,
torch
.
float64
))
# , ids=str)
@
pytest
.
mark
.
parametrize
(
"contiguous"
,
(
True
,
False
))
@
pytest
.
mark
.
parametrize
(
"deterministic"
,
(
True
,
False
))
@
pytest
.
mark
.
opcheck_only_one
()
def
test_forward
(
self
,
device
,
contiguous
,
deterministic
,
aligned
,
x_dtype
,
rois_dtype
=
None
):
if
deterministic
and
device
==
"cpu"
:
pytest
.
skip
(
"cpu is always deterministic, don't retest"
)
...
...
@@ -491,6 +492,7 @@ class TestRoIAlign(RoIOpTester):
@
pytest
.
mark
.
parametrize
(
"deterministic"
,
(
True
,
False
))
@
pytest
.
mark
.
parametrize
(
"x_dtype"
,
(
torch
.
float
,
torch
.
half
))
@
pytest
.
mark
.
parametrize
(
"rois_dtype"
,
(
torch
.
float
,
torch
.
half
))
@
pytest
.
mark
.
opcheck_only_one
()
def
test_autocast
(
self
,
aligned
,
deterministic
,
x_dtype
,
rois_dtype
):
with
torch
.
cuda
.
amp
.
autocast
():
self
.
test_forward
(
...
...
@@ -506,6 +508,7 @@ class TestRoIAlign(RoIOpTester):
@
pytest
.
mark
.
parametrize
(
"device"
,
cpu_and_cuda_and_mps
())
@
pytest
.
mark
.
parametrize
(
"contiguous"
,
(
True
,
False
))
@
pytest
.
mark
.
parametrize
(
"deterministic"
,
(
True
,
False
))
@
pytest
.
mark
.
opcheck_only_one
()
def
test_backward
(
self
,
seed
,
device
,
contiguous
,
deterministic
):
if
deterministic
and
device
==
"cpu"
:
pytest
.
skip
(
"cpu is always deterministic, don't retest"
)
...
...
@@ -520,6 +523,7 @@ class TestRoIAlign(RoIOpTester):
@
pytest
.
mark
.
parametrize
(
"aligned"
,
(
True
,
False
))
@
pytest
.
mark
.
parametrize
(
"scale, zero_point"
,
((
1
,
0
),
(
2
,
10
),
(
0.1
,
50
)))
@
pytest
.
mark
.
parametrize
(
"qdtype"
,
(
torch
.
qint8
,
torch
.
quint8
,
torch
.
qint32
))
@
pytest
.
mark
.
opcheck_only_one
()
def
test_qroialign
(
self
,
aligned
,
scale
,
zero_point
,
qdtype
):
"""Make sure quantized version of RoIAlign is close to float version"""
pool_size
=
5
...
...
@@ -589,6 +593,15 @@ class TestRoIAlign(RoIOpTester):
self
.
_helper_jit_boxes_list
(
model
)
optests
.
generate_opcheck_tests
(
testcase
=
TestRoIAlign
,
namespaces
=
[
"torchvision"
],
failures_dict_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"optests_failures_dict.json"
),
additional_decorators
=
[],
test_utils
=
OPTESTS
,
)
class
TestPSRoIAlign
(
RoIOpTester
):
mps_backward_atol
=
5e-2
...
...
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