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
ea34cd1e
Unverified
Commit
ea34cd1e
authored
May 21, 2021
by
Nicolas Hug
Committed by
GitHub
May 21, 2021
Browse files
Use torch.testing.assert_close in test_onnx.py (#3882)
Co-authored-by:
Philip Meier
<
github.pmeier@posteo.de
>
parent
c307db4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
test/test_onnx.py
test/test_onnx.py
+5
-4
No files found.
test/test_onnx.py
View file @
ea34cd1e
...
...
@@ -7,6 +7,7 @@ except ImportError:
onnxruntime
=
None
from
common_utils
import
set_rng_seed
from
_assert_utils
import
assert_equal
import
io
import
torch
from
torchvision
import
ops
...
...
@@ -483,8 +484,8 @@ class ONNXExporterTester(unittest.TestCase):
jit_trace
=
torch
.
jit
.
trace
(
heatmaps_to_keypoints
,
(
maps
,
rois
))
out_trace
=
jit_trace
(
maps
,
rois
)
assert
torch
.
al
l
(
out
[
0
]
.
eq
(
out_trace
[
0
])
)
assert
torch
.
al
l
(
out
[
1
]
.
eq
(
out_trace
[
1
])
)
assert
_equa
l
(
out
[
0
]
,
out_trace
[
0
])
assert
_equa
l
(
out
[
1
]
,
out_trace
[
1
])
maps2
=
torch
.
rand
(
20
,
2
,
21
,
21
)
rois2
=
torch
.
rand
(
20
,
4
)
...
...
@@ -492,8 +493,8 @@ class ONNXExporterTester(unittest.TestCase):
out2
=
heatmaps_to_keypoints
(
maps2
,
rois2
)
out_trace2
=
jit_trace
(
maps2
,
rois2
)
assert
torch
.
al
l
(
out2
[
0
]
.
eq
(
out_trace2
[
0
])
)
assert
torch
.
al
l
(
out2
[
1
]
.
eq
(
out_trace2
[
1
])
)
assert
_equa
l
(
out2
[
0
]
,
out_trace2
[
0
])
assert
_equa
l
(
out2
[
1
]
,
out_trace2
[
1
])
def
test_keypoint_rcnn
(
self
):
images
,
test_images
=
self
.
get_test_images
()
...
...
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