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.
19 from extensions.front.tf.deconv_ext import Conv2DBackpropInputFrontExtractor
20 from mo.utils.unittest.extractors import PB, BaseExtractorsTestingClass
23 class DeconvolutionExtractorTest(BaseExtractorsTestingClass):
26 cls.strides = [1, 2, 3, 4]
28 def test_deconv2d_defaults(self):
29 node = PB({'pb': PB({'attr': {
34 'list': PB({"i": self.strides})
42 'pad': None, # will be inferred when input shape is known
43 'pad_spatial_shape': None,
44 'output_spatial_shape': None,
48 Conv2DBackpropInputFrontExtractor.extract(node)
50 self.expected_call_args = (None, False)
53 def test_deconv2d_nhwc(self):
54 node = PB({'pb': PB({'attr': {
59 'list': PB({"i": self.strides})
67 "spatial_dims": [1, 2],
70 'stride': np.array(self.strides, dtype=np.int8),
73 Conv2DBackpropInputFrontExtractor.extract(node)
75 self.expected_call_args = (None, False)
78 def test_deconv2d_nchw(self):
79 node = PB({'pb': PB({'attr': {
84 'list': PB({"i": self.strides})
91 "spatial_dims": [2, 3],
94 'stride': np.array(self.strides, dtype=np.int8),
97 Conv2DBackpropInputFrontExtractor.extract(node)
99 self.expected_call_args = (None, False)