2 Copyright (c) 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.
17 from unittest.mock import patch
19 from extensions.front.caffe.bias_ext import BiasToAdd
20 from mo.utils.unittest.extractors import FakeModelLayer, FakeMultiParam
21 from mo.utils.unittest.graph import FakeNode
24 class FakeBiasProtoLayer:
25 def __init__(self, val):
29 class TestBias(unittest.TestCase):
31 @patch('extensions.front.caffe.bias_ext.embed_input')
32 def test_bias(self, embed_input_mock):
33 embed_input_mock.return_value = {}
35 add_node = FakeNode(FakeBiasProtoLayer(FakeMultiParam(params)),
36 FakeModelLayer([1, 2, 3, 4, 5]))
37 BiasToAdd.extract(add_node)
45 for key in exp_res.keys():
46 self.assertEqual(add_node[key], exp_res[key])