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
c307db4b
Unverified
Commit
c307db4b
authored
May 21, 2021
by
Nicolas Hug
Committed by
GitHub
May 21, 2021
Browse files
Use torch.testing.assert_close in test_detection_utils.py (#3881)
Co-authored-by:
Philip Meier
<
github.pmeier@posteo.de
>
parent
86d45414
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
test/test_models_detection_utils.py
test/test_models_detection_utils.py
+3
-2
No files found.
test/test_models_detection_utils.py
View file @
c307db4b
...
...
@@ -4,6 +4,7 @@ from torchvision.models.detection import _utils
from
torchvision.models.detection.transform
import
GeneralizedRCNNTransform
import
unittest
from
torchvision.models.detection
import
backbone_utils
from
_assert_utils
import
assert_equal
class
Tester
(
unittest
.
TestCase
):
...
...
@@ -55,8 +56,8 @@ class Tester(unittest.TestCase):
targets
=
[{
'boxes'
:
torch
.
rand
(
3
,
4
)},
{
'boxes'
:
torch
.
rand
(
2
,
4
)}]
targets_copy
=
copy
.
deepcopy
(
targets
)
out
=
transform
(
image
,
targets
)
# noqa: F841
self
.
assert
True
(
torch
.
equal
(
targets
[
0
][
'boxes'
],
targets_copy
[
0
][
'boxes'
])
)
self
.
assert
True
(
torch
.
equal
(
targets
[
1
][
'boxes'
],
targets_copy
[
1
][
'boxes'
])
)
assert
_
equal
(
targets
[
0
][
'boxes'
],
targets_copy
[
0
][
'boxes'
])
assert
_
equal
(
targets
[
1
][
'boxes'
],
targets_copy
[
1
][
'boxes'
])
def
test_not_float_normalize
(
self
):
transform
=
GeneralizedRCNNTransform
(
300
,
500
,
torch
.
zeros
(
3
),
torch
.
ones
(
3
))
...
...
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