2 Copyright (c) 2017-2018 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.kaldi.replace_lstm_node_pattern import create_node
20 from mo.front.common.replacement import FrontReplacementOp
21 from mo.graph.graph import Node
24 class ReplaceConvolutionReshape(FrontReplacementOp):
28 def replace_op(self, graph: nx.MultiDiGraph, node: Node):
29 input_nodes = node.in_nodes()
31 conv_attrs = graph.node[node.id]['pb'].__dict__
32 input_reshape = create_node(graph, 'Reshape_Convolution', {'type': 'Reshape',
36 tuple(n.id for i, n in input_nodes.items()))
37 convolution = create_node(graph, 'Convolution', conv_attrs, tuple([input_reshape.id]))
38 output_reshape = create_node(graph, 'Convolution_Reshape', {'type': 'Reshape',
42 tuple([convolution.id]))
44 return [output_reshape.id]