Showing the changes to tools/python/convert_from_tensorflow.py (1 of 3 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | |||
| 20 | import tensorflow as tf | 20 | import tensorflow as tf |
| 21 | import numpy as np | 21 | import numpy as np |
| 22 | import sys, struct | 22 | import sys, struct |
| 23 | import convert_header as header | ||
| 23 | 24 | ||
| 24 | __all__ = ['convert_from_tensorflow'] | 25 | __all__ = ['convert_from_tensorflow'] |
| 25 | 26 | ||
| @@ -229,6 +230,8 @@ class TFConverter: · 203 unmodified lines | |||
| 229 | 230 | ||
| 230 | def dump_to_file(self): | 231 | def dump_to_file(self): |
| 231 | with open(self.outfile, 'wb') as f: | 232 | with open(self.outfile, 'wb') as f: |
| 233 | f.write(header.str.encode('utf-8')) | ||
| 234 | np.array([header.major, header.minor], dtype=np.uint32).tofile(f) | ||
| 232 | self.dump_layers_to_file(f) | 235 | self.dump_layers_to_file(f) |
| 233 | self.dump_operands_to_file(f) | 236 | self.dump_operands_to_file(f) |
| 234 | np.array([self.layer_number, len(self.name_operand_dict)], dtype=np.uint32).tofile(f) | 237 | np.array([self.layer_number, len(self.name_operand_dict)], dtype=np.uint32).tofile(f) |