diff --git a/model-optimizer/mo/front/kaldi/loader/loader.py b/model-optimizer/mo/front/kaldi/loader/loader.py index c6298aab957827..dcbc01bc25a511 100644 --- a/model-optimizer/mo/front/kaldi/loader/loader.py +++ b/model-optimizer/mo/front/kaldi/loader/loader.py @@ -76,7 +76,7 @@ def load_parallel_component(file_descr, graph: Graph, prev_layer_id): variadic_split_node = AttributedVariadicSplit(graph, attrs).create_node() prev_layer_node = Node(graph, prev_layer_id) prev_layer_node.add_output_port(0) - prev_layer_node.out_port(0).connect(variadic_split_node.in_port(0)) + graph.create_edge(prev_layer_node, variadic_split_node, 0, 0) concat_id = graph.unique_id(prefix='Concat') graph.add_node(concat_id, parameters=None, op='concat', kind='op') @@ -87,8 +87,8 @@ def load_parallel_component(file_descr, graph: Graph, prev_layer_id): for i, (input_node, output_node) in enumerate(zip(inputs, outputs)): output_node.add_output_port(0) concat_node.add_input_port(i) - output_node.out_port(0).connect(concat_node.in_port(i)) - variadic_split_node.out_port(i).connect(input_node.in_port(0)) + graph.create_edge(output_node, concat_node, 0, i) + graph.create_edge(variadic_split_node, input_node, i, 0) return concat_id diff --git a/model-optimizer/mo/graph/connection.py b/model-optimizer/mo/graph/connection.py index e524292e657f68..3ef6fa843f1df6 100644 --- a/model-optimizer/mo/graph/connection.py +++ b/model-optimizer/mo/graph/connection.py @@ -81,7 +81,7 @@ def set_source(self, port): if self.control_flow is True: raise Error("Cannot operate with connection with control_flow=True") - if self.graph.stage in ['front', None]: + if self.graph.stage == 'front': scr_node = port.node # Reconnecting all destinations as consumers to the source port preserving edge attrs for dst_port in self.destinations: @@ -204,7 +204,7 @@ def add_destination(self, port): if self.source is None: raise Error("Can not add destination for connection without source port!") - if self.graph.stage in ['front', None]: + if self.graph.stage == 'front': node = self.source.node self.graph.create_edge(node, port.node, out_port=self.source.idx, in_port=port.idx) else: