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
d62c1df3
"vscode:/vscode.git/clone" did not exist on "bc2fef9c320601194b23da889fcfcbb7ce9701a9"
Unverified
Commit
d62c1df3
authored
Jul 22, 2021
by
Gary Miguel
Committed by
GitHub
Jul 22, 2021
Browse files
Use pytest.importorskip for onnx tests instead of custom logic (#4185)
parent
75970b61
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
10 deletions
+5
-10
test/test_onnx.py
test/test_onnx.py
+5
-10
No files found.
test/test_onnx.py
View file @
d62c1df3
# onnxruntime requires python 3.5 or above
try
:
# This import should be before that of torch
# see https://github.com/onnx/onnx/issues/2394#issuecomment-581638840
import
onnxruntime
except
ImportError
:
onnxruntime
=
None
from
common_utils
import
set_rng_seed
,
assert_equal
from
common_utils
import
set_rng_seed
,
assert_equal
import
io
import
io
import
pytest
import
torch
import
torch
from
torchvision
import
ops
from
torchvision
import
ops
from
torchvision
import
models
from
torchvision
import
models
...
@@ -20,11 +13,13 @@ from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, TwoMLPHe
...
@@ -20,11 +13,13 @@ from torchvision.models.detection.faster_rcnn import FastRCNNPredictor, TwoMLPHe
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
typing
import
List
,
Tuple
from
typing
import
List
,
Tuple
import
pytest
from
torchvision.ops._register_onnx_ops
import
_onnx_opset_version
from
torchvision.ops._register_onnx_ops
import
_onnx_opset_version
# In environments without onnxruntime we prefer to
# invoke all tests in the repo and have this one skipped rather than fail.
onnxruntime
=
pytest
.
importorskip
(
"onnxruntime"
)
@
pytest
.
mark
.
skipif
(
onnxruntime
is
None
,
reason
=
'ONNX Runtime unavailable'
)
class
TestONNXExporter
:
class
TestONNXExporter
:
@
classmethod
@
classmethod
def
setup_class
(
cls
):
def
setup_class
(
cls
):
...
...
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