Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuo, Yejun <yejun.guo@intel.com>2019-08-29 08:53:41 +0300
committerPedro Arthur <bygrandao@gmail.com>2019-08-30 17:41:30 +0300
commit2d5e39c13e500f96a18729ac16472ff69f8d2cfe (patch)
tree79343e50f7dc0efe36ba8f108d71f9e88e912f39 /tools/python
parent09a455a24649af36e8eea81029be7a410201be4c (diff)
dnn: change .model file format to put layer number at the end of file
currently, the layer number is at the beginning of the .model file, so we have to scan twice in python script, the first scan to get the layer number. Only one scan needed after put the layer number at the end of .model file. Signed-off-by: Guo, Yejun <yejun.guo@intel.com> Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
Diffstat (limited to 'tools/python')
-rw-r--r--tools/python/convert_from_tensorflow.py12
1 files changed, 1 insertions, 11 deletions
diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py
index 34454b86de..cbc76a9f03 100644
--- a/tools/python/convert_from_tensorflow.py
+++ b/tools/python/convert_from_tensorflow.py
@@ -129,15 +129,6 @@ class TFConverter:
self.converted_nodes.add(node.name)
- def generate_layer_number(self):
- # in current hard code implementation, the layer number is the first data written to the native model file
- # it is not easy to know it at the beginning time in the general converter, so first do a dry run for compatibility
- # will be refined later.
- with open('/tmp/tmp.model', 'wb') as f:
- self.dump_layers_to_file(f)
- self.converted_nodes.clear()
-
-
def dump_layers_to_file(self, f):
for node in self.nodes:
if node.name in self.converted_nodes:
@@ -157,10 +148,9 @@ class TFConverter:
def dump_to_file(self):
- self.generate_layer_number()
with open(self.outfile, 'wb') as f:
- np.array([self.layer_number], dtype=np.uint32).tofile(f)
self.dump_layers_to_file(f)
+ np.array([self.layer_number], dtype=np.uint32).tofile(f)
def generate_name_node_dict(self):