This repository has been archived by the owner on Jan 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
increase code coverage, code refactoring
- Loading branch information
Showing
18 changed files
with
278 additions
and
215 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
@brief test log(time=2s) | ||
""" | ||
import unittest | ||
import numpy | ||
from onnx.numpy_helper import from_array | ||
from pyquickhelper.pycode import ExtTestCase | ||
from skl2onnx.algebra.onnx_ops import ( # pylint: disable=E0611 | ||
OnnxConstant, OnnxAdd) | ||
from mlprodict.onnxrt import OnnxInference | ||
|
||
|
||
class TestCoverageRuntimeOps(ExtTestCase): | ||
|
||
def test_op_constant(self): | ||
for opv in [9, 10, 11, 12]: | ||
for dtype in [numpy.float32, numpy.float64, | ||
numpy.int32, numpy.int64]: | ||
with self.subTest(opv=opv, dtype=dtype): | ||
X = numpy.array([1], dtype=dtype) | ||
pX = from_array(X) | ||
op = OnnxAdd('X', OnnxConstant(op_version=opv, value=pX), | ||
output_names=['Y'], op_version=opv) | ||
onx = op.to_onnx({'X': X}) | ||
oinf = OnnxInference(onx) | ||
res = oinf.run({'X': X}) | ||
self.assertEqualArray(res['Y'], X + X) | ||
|
||
|
||
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
Oops, something went wrong.