From 252fd63194dc0fd50048a2409a2d6a6a693ebcfa Mon Sep 17 00:00:00 2001
From: Dmitry Kurtaev <dmitry.kurtaev+github@gmail.com>
Date: Thu, 31 Jan 2019 13:40:54 +0300
Subject: [PATCH] Align TensorFlow and OpenCV paths to create a text graph

---
 samples/dnn/tf_text_graph_common.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/samples/dnn/tf_text_graph_common.py b/samples/dnn/tf_text_graph_common.py
index a644420780..5a8e62495d 100644
--- a/samples/dnn/tf_text_graph_common.py
+++ b/samples/dnn/tf_text_graph_common.py
@@ -323,7 +323,7 @@ def writeTextGraph(modelPath, outputPath, outNodes):
 
             for node in graph_def.node:
                 if node.op == 'Const':
-                    if 'value' in node.attr:
-                        del node.attr['value']
+                    if 'value' in node.attr and node.attr['value'].tensor.tensor_content:
+                        node.attr['value'].tensor.tensor_content = ''
 
         tf.train.write_graph(graph_def, "", outputPath, as_text=True)
-- 
2.18.0