Showing the changes to tools/python (2 of 3 files). Show all
Unified · Split
| @@ -20,6 +20,7 @@ · 19 unmodified lines | ||
| 20 | 20 | import tensorflow as tf |
| 21 | 21 | import numpy as np |
| 22 | 22 | import sys, struct |
| 23 | +import convert_header as header | |
| 23 | 24 | |
| 24 | 25 | __all__ = ['convert_from_tensorflow'] |
| 25 | 26 | |
| @@ -229,6 +230,8 @@ class TFConverter: · 203 unmodified lines | ||
| 229 | 230 | |
| 230 | 231 | def dump_to_file(self): |
| 231 | 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 | 235 | self.dump_layers_to_file(f) |
| 233 | 236 | self.dump_operands_to_file(f) |
| 234 | 237 | np.array([self.layer_number, len(self.name_operand_dict)], dtype=np.uint32).tofile(f) |
| @@ -0,0 +1,26 @@ | ||
| 1 | +# Copyright (c) 2019 | |
| 2 | +# | |
| 3 | +# This file is part of FFmpeg. | |
| 4 | +# | |
| 5 | +# FFmpeg is free software; you can redistribute it and/or | |
| 6 | +# modify it under the terms of the GNU Lesser General Public | |
| 7 | +# License as published by the Free Software Foundation; either | |
| 8 | +# version 2.1 of the License, or (at your option) any later version. | |
| 9 | +# | |
| 10 | +# FFmpeg is distributed in the hope that it will be useful, | |
| 11 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | +# Lesser General Public License for more details. | |
| 14 | +# | |
| 15 | +# You should have received a copy of the GNU Lesser General Public | |
| 16 | +# License along with FFmpeg; if not, write to the Free Software | |
| 17 | +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
| 18 | +# ============================================================================== | |
| 19 | + | |
| 20 | +str = 'FFMPEGDNNNATIVE' | |
| 21 | + | |
| 22 | +# increase major and reset minor when we have to re-convert the model file | |
| 23 | +major = 0 | |
| 24 | + | |
| 25 | +# increase minor when we don't have to re-convert the model file | |
| 26 | +minor = 1 | |