File: onnxfns1A_test.py

package info (click to toggle)
onnxscript 0.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 12,384 kB
  • sloc: python: 75,957; sh: 41; makefile: 6
file content (59 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest

import pytest

from tests.common import onnx_script_test_case
from tests.models import onnxfns1A


class TestOnnxFns(onnx_script_test_case.OnnxScriptTestCase):
    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        cls.rtol = 1e-05

    def test_onnxfns_relu(self):
        self.run_onnx_test(onnxfns1A.Relu)

    def test_onnxfns_selu(self):
        self.run_onnx_test(onnxfns1A.Selu)

    def test_onnxfns_elu(self):
        self.run_onnx_test(onnxfns1A.Elu)

    def test_onnxfns_elu05(self):
        self.run_onnx_test(onnxfns1A.Elu05)

    def test_onnxfns_thresholded_relu(self):
        self.run_onnx_test(onnxfns1A.ThresholdedRelu)

    def test_onnxfns_leaky_relu(self):
        self.run_onnx_test(onnxfns1A.LeakyRelu)

    def test_onnxfns_prelu(self):
        self.run_onnx_test(onnxfns1A.PRelu)

    def test_onnxfns_hard_sigmoid(self):
        self.run_onnx_test(onnxfns1A.HardSigmoid)

    def test_onnxfns_shrink(self):
        self.run_onnx_test(onnxfns1A.Shrink)

    def test_onnxfns_hard_softplus(self):
        self.run_onnx_test(onnxfns1A.Softplus)

    def test_onnxfns_hard_softsign(self):
        self.run_onnx_test(onnxfns1A.Softsign)

    @pytest.mark.xfail(
        strict=True,
        reason="Clip has optional input min and max. Need to find out how to pass default min and max to the test case executor.",
    )
    def test_onnxfns_hard_clip(self):
        self.run_onnx_test(onnxfns1A.Clip)


if __name__ == "__main__":
    unittest.main(verbosity=2)