Skip to content

Latest commit

 

History

History

tensorflow_model_freezer

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Prerequisites

The scripts here use TensorFlow's tools, so you need an environment to run TensorFlow. Running the scripts within this tutorial requires:

  • Install TensorFlow v1.12 or later
    • Use pip
    $ pip install tensorflow==1.12
    

What this tool is about

This tool generaes the following files:

  1. Tensorflow model files in *.pb, *.pbtxt
  2. Tensorflow model after freezing in *.pb, *.pbtxt
  3. Tensorboard log file to visually see the above 1 and 2.
  4. TFLITE file after running TOCO

By define Test Cases, you can easily and quickly generate files for various ranks of operands.

How to use

  • Copy MUL_gen.py or TOPK_gen.py and modify for your taste.

    • Note that TOPK_gen.py fails while generating TFLITE file since TOCO does not support TOPK oeration.
  • Run ~/nnfw$ PYTHONPATH=$PYTHONPATH:./tools/tensorflow_model_freezer/ python tools/tensorflow_model_freezer/sample/MUL_gen.py ~/temp

    • Files will be generated under ~/temp

How to run

$ chmod +x tools/tensorflow_model_freezer/sample/name_of_this_file.py
$ PYTHONPATH=$PYTHONPATH:./tools/tensorflow_model_freezer/ \
      tools/tensorflow_model_freezer/sample/name_of_this_file.py \
      ~/temp  # directory where model files are saved

Note

  • This tool is tested with Python 2.7 and 3