Publishing 2019 R1 content
[platform/upstream/dldt.git] / model-optimizer / extensions / middle / FusePermutesSequence.py
index ea5c1c1..a230c6b 100644 (file)
@@ -1,5 +1,5 @@
 """
- Copyright (c) 2018 Intel Corporation
+ Copyright (c) 2018-2019 Intel Corporation
 
  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  See the License for the specific language governing permissions and
  limitations under the License.
 """
-
-import networkx as nx
 import numpy as np
 
 from extensions.middle.ConvertLayoutDependentOperations import ConvertLayoutDependentOperations
-from mo.graph.graph import Node
+from mo.graph.graph import Node, Graph
 from mo.middle.passes.eliminate import merge_data_nodes, graph_clean_up_tf
 from mo.middle.passes.fusing.helpers import get_next_operation
 from mo.middle.replacement import MiddleReplacementPattern
@@ -32,11 +30,12 @@ class FusePermutesSequence(MiddleReplacementPattern):
     """
 
     enabled = True
+    graph_condition = [lambda graph: graph.graph['fw'] != 'caffe']
 
     def run_after(self):
         return [ConvertLayoutDependentOperations]
 
-    def find_and_replace_pattern(self, graph: nx.MultiDiGraph):
+    def find_and_replace_pattern(self, graph: Graph):
         for node in list(graph.nodes()):
             if node not in graph.nodes():
                 continue