This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ONNX test code cleanup * Make tests use the common test case list * Remove import test_cases * Make Gluon backend rep common * Partially enable broadcast tests * Common function to populate tests * Make backend common * test models * Test nodes * ONNX export: Test for fully connected * Edit CI scripts mxnet export test cleanup * Further cleanup backend tests * README * Some corrections * test case format for test_models
- Loading branch information
1 parent
48bbac5
commit fd34dc5
Showing
18 changed files
with
790 additions
and
1,327 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# ONNX tests | ||
|
||
## Directory structure: | ||
|
||
```bash | ||
. | ||
├── README.md | ||
├── backend.py | ||
├── backend_rep.py | ||
├── backend_test.py | ||
├── gluon_backend_test.py | ||
├── mxnet_backend_test.py | ||
├── mxnet_export_test.py | ||
├── test_cases.py | ||
├── test_models.py | ||
└── test_node.py | ||
``` | ||
|
||
* `backend.py` - MXNetBackend. This file contains prepare(). \ | ||
This class can be used for both, MXNet and Gluon backend. | ||
* `backend_rep.py` - MXNetBackendRep and GluonBackendRep for running inference | ||
* `backend_test.py` - prepare tests by including tests from `test_cases.py` | ||
* `gluon_backend_test.py` - Set backend as gluon and execute ONNX tests for ONNX->Gluon import. | ||
* `mxnet_backend_test.py` - Set backend as gluon and add tests for ONNX->MXNet import/export. | ||
Since MXNetBackend for export, tests both import and export, the test list in this file is | ||
a union of tests that execute for import and export, export alone, and import alone. | ||
* `mxnet_export_test.py` - Execute unit tests for testing MXNet export code - this is not specific to | ||
any operator. | ||
* `test_cases.py` - list of test cases for operators/models that are supported | ||
for "both", import and export, "import" alone, or "export" alone. | ||
* `test_models.py` - custom tests for models | ||
* `test_node.py` - custom tests for operators. These tests are written independent of ONNX tests, in case | ||
ONNX doesn't have tests yet or for MXNet specific operators. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
"""ONNX test backend wrapper""" | ||
try: | ||
import onnx.backend.test | ||
except ImportError: | ||
raise ImportError("Onnx and protobuf need to be installed") | ||
|
||
import test_cases | ||
|
||
|
||
def prepare_tests(backend, operation): | ||
""" | ||
Prepare the test list | ||
:param backend: mxnet/gluon backend | ||
:param operation: str. export or import | ||
:return: backend test list | ||
""" | ||
BACKEND_TESTS = onnx.backend.test.BackendTest(backend, __name__) | ||
implemented_ops = test_cases.IMPLEMENTED_OPERATORS_TEST.get('both', []) + \ | ||
test_cases.IMPLEMENTED_OPERATORS_TEST.get(operation, []) | ||
|
||
for op_test in implemented_ops: | ||
BACKEND_TESTS.include(op_test) | ||
|
||
basic_models = test_cases.BASIC_MODEL_TESTS.get('both', []) + \ | ||
test_cases.BASIC_MODEL_TESTS.get(operation, []) | ||
|
||
for basic_model_test in basic_models: | ||
BACKEND_TESTS.include(basic_model_test) | ||
|
||
std_models = test_cases.STANDARD_MODEL.get('both', []) + \ | ||
test_cases.STANDARD_MODEL.get(operation, []) | ||
|
||
for std_model_test in std_models: | ||
BACKEND_TESTS.include(std_model_test) | ||
|
||
BACKEND_TESTS.exclude('.*bcast.*') | ||
|
||
return BACKEND_TESTS |
Oops, something went wrong.