Publishing 2019 R1 content
[platform/upstream/dldt.git] / model-optimizer / mo / front / common / partial_infer / elemental.py
index 99adb1f..c33a356 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.
@@ -19,14 +19,19 @@ def single_output_infer(node, shape_infer, value_infer=None):
     node.out_node(0).shape = shape_infer(node)
 
     if value_infer is not None and \
-       'value' in node.in_node() and \
-       node.in_node().value is not None:
+            'value' in node.in_node() and \
+            node.in_node().value is not None:
         node.out_node(0).value = value_infer(node)
 
-def copy_shape_infer(node):
+
+def copy_shape_infer(node, value_infer=None):
     """
     Sets output dimensions of node equal to input ones
     Args:
         node: graph node
     """
-    single_output_infer(node, lambda n: n.in_node().shape)
+    single_output_infer(node, lambda n: n.in_node().shape, value_infer)
+
+
+def copy_value(node):
+    return None if node.in_node().value is None else node.in_node().value.copy()