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
86d45414
Unverified
Commit
86d45414
authored
May 21, 2021
by
Nicolas Hug
Committed by
GitHub
May 21, 2021
Browse files
Use torch.testing.assert_close in test_anchor_utils.py (#3880)
Co-authored-by:
Philip Meier
<
github.pmeier@posteo.de
>
parent
ed239b8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
test/test_models_detection_anchor_utils.py
test/test_models_detection_anchor_utils.py
+5
-4
No files found.
test/test_models_detection_anchor_utils.py
View file @
86d45414
import
torch
from
common_utils
import
TestCase
from
_assert_utils
import
assert_equal
from
torchvision.models.detection.anchor_utils
import
AnchorGenerator
,
DefaultBoxGenerator
from
torchvision.models.detection.image_list
import
ImageList
...
...
@@ -62,8 +63,8 @@ class Tester(TestCase):
self
.
assertEqual
(
len
(
anchors
),
2
)
self
.
assertEqual
(
tuple
(
anchors
[
0
].
shape
),
(
9
,
4
))
self
.
assertEqual
(
tuple
(
anchors
[
1
].
shape
),
(
9
,
4
))
self
.
assert
E
qual
(
anchors
[
0
],
anchors_output
)
self
.
assert
E
qual
(
anchors
[
1
],
anchors_output
)
assert
_e
qual
(
anchors
[
0
],
anchors_output
)
assert
_e
qual
(
anchors
[
1
],
anchors_output
)
def
test_defaultbox_generator
(
self
):
images
=
torch
.
zeros
(
2
,
3
,
15
,
15
)
...
...
@@ -85,5 +86,5 @@ class Tester(TestCase):
self
.
assertEqual
(
len
(
dboxes
),
2
)
self
.
assertEqual
(
tuple
(
dboxes
[
0
].
shape
),
(
4
,
4
))
self
.
assertEqual
(
tuple
(
dboxes
[
1
].
shape
),
(
4
,
4
))
self
.
assert
Tru
e
(
dboxes
[
0
]
.
allclose
(
dboxes_output
)
)
self
.
assert
Tru
e
(
dboxes
[
1
]
.
allclose
(
dboxes_output
)
)
torch
.
testing
.
assert
_clos
e
(
dboxes
[
0
]
,
dboxes_output
,
rtol
=
1e-5
,
atol
=
1e-8
)
torch
.
testing
.
assert
_clos
e
(
dboxes
[
1
]
,
dboxes_output
,
rtol
=
1e-5
,
atol
=
1e-8
)
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