2 Copyright (c) 2018-2019 Intel Corporation
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
22 from extensions.front.onnx.sigmoid_ext import SigmoidFrontExtractor
23 from mo.utils.unittest.graph import build_graph
24 from mo.graph.graph import Node
27 class SigmoidONNXExtractorTest(unittest.TestCase):
30 pb = onnx.helper.make_node("Sigmoid", ["X"], ["Y"])
31 graph = build_graph({'node_0': {'pb': pb}}, [])
32 return Node(graph, 'node_0')
36 # Commonly used attributes in the tests
37 # Each test takes these ones and then adds/modifies/deletes particular fields
39 # reference output Node attributes
48 node = __class__._create_node()
49 SigmoidFrontExtractor.extract(node)
50 return node.graph.node[node.id]
52 def _match(self, out, ref):
53 for key in ref.keys():
54 status = out[key] == ref[key]
55 if type(status) in [list, np.ndarray]:
56 status = np.all(status)
57 self.assertTrue(status, 'Mismatch for field {}, observed: {}, expected: {}'.format(key, out[key], ref[key]))
59 def test_default(self):
60 ref = self._base_attrs()