Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
increase code coverage
- Loading branch information
Showing
22 changed files
with
192 additions
and
21 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,34 @@ | ||
|
||
Tutorials | ||
========= | ||
|
||
.. contents:: | ||
:local: | ||
|
||
ONNX ecosystem | ||
++++++++++++++ | ||
|
||
Following tutorials introduce the :epkg:`ONNX` ecosystem. It walk the | ||
user through the ONNX specficiations, how to execute an ONNX graph, | ||
how to create an ONNX graph, how to convert a model from :epkg:`scikit-learn`, | ||
and how to train them with :epkg:`onnxruntime-training`. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
tutorial_onnx/index | ||
tutorial_skl/index | ||
tutorial_bench/index | ||
tutorial_training/index | ||
|
||
Current documention of ONNX and onnxruntime | ||
+++++++++++++++++++++++++++++++++++++++++++ | ||
|
||
Most of the documentation related on :epkg:`onnx` and :epkg:`onnxruntime` | ||
is written on :epkg:`markdown`. The following section is an attempt | ||
to render it and make it searchable. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
onnxmd/index |
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 @@ | ||
plot_orttraining_benchmark_torch.py |
35 changes: 35 additions & 0 deletions
35
_unittests/ut_documentation/test_documentation_check_coverage.py
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,35 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@brief test log(time=2800s) | ||
""" | ||
import os | ||
import unittest | ||
from pyquickhelper.pycode import ExtTestCase | ||
|
||
|
||
class TestDocumentationCheckCoverage(ExtTestCase): | ||
|
||
def test_notebook_artificiel(self): | ||
with open( | ||
os.path.join(os.path.dirname(__file__), | ||
"_test_example.txt"), "r", encoding='utf-8') as f: | ||
lines = f.read().split('\n') | ||
|
||
this = os.path.abspath(os.path.dirname(__file__)) | ||
fold = os.path.normpath( | ||
os.path.join(this, '..', '..', '_doc', 'examples')) | ||
found = os.listdir(fold) | ||
|
||
done = set(_ for _ in lines if os.path.splitext(_)[-1] == '.py') | ||
found = set(_ for _ in found | ||
if (os.path.splitext(_)[-1] == '.py' and | ||
_.startswith('plot_'))) | ||
if len(done) != len(found): | ||
missing = found - done | ||
raise AssertionError( | ||
"Following example were not tested:\n%s." | ||
"" % "\n".join(sorted(missing))) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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
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
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
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,29 @@ | ||
""" | ||
@brief test log(time=1s) | ||
""" | ||
import unittest | ||
from pyquickhelper.pycode import ExtTestCase | ||
from onnxcustom.utils.onnxruntime_helper import ( | ||
device_to_provider, provider_to_device, get_ort_device_type) | ||
|
||
|
||
class TestOnnxRuntimeHelper(ExtTestCase): | ||
|
||
def test_provider_to_device(self): | ||
self.assertEqual(provider_to_device('CPUExecutionProvider'), 'cpu') | ||
self.assertEqual(provider_to_device('CUDAExecutionProvider'), 'cuda') | ||
self.assertRaise(lambda: provider_to_device('NONE'), ValueError) | ||
|
||
def test_device_to_provider(self): | ||
self.assertEqual(device_to_provider('cpu'), 'CPUExecutionProvider') | ||
self.assertEqual(device_to_provider('gpu'), 'CUDAExecutionProvider') | ||
self.assertRaise(lambda: device_to_provider('NONE'), ValueError) | ||
|
||
def test_get_ort_device_type(self): | ||
self.assertEqual(get_ort_device_type('cpu'), 0) | ||
self.assertEqual(get_ort_device_type('cuda'), 1) | ||
self.assertRaise(lambda: get_ort_device_type('none'), ValueError) | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() |
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
@file | ||
@brief Shortcuts to *training*. | ||
""" | ||
from .excs import ConvergenceError # noqa |
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
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