This directory contains a simple utility to convert TensorFlow models to C++ or Numpy code. See tfconvert.py for the main goal/motivation. ---------------------------------------------------------------------- One-time setup: - Install Anaconda python - conda install keras tensorflow theano If you're compiling C++ models: - tar xf eigen-3.3-beta2.tar.bz2 ---------------------------------------------------------------------- Tests - follow the instructions after running the command(s) below to complete all testing. KERAS_BACKEND=tensorflow python test1.py KERAS_BACKEND=tensorflow python test2.py Models trained in Theano can also be converted to TensorFlow: https://github.com/fchollet/keras/wiki/Converting-convolution-kernels-from-Theano-to-TensorFlow-and-vice-versa Theano can be trained on Windows. ---------------------------------------------------------------------- Converting a saved Keras model (from model.save()): KERAS_BACKEND=tensorflow python convert_keras.py nnet_bds BdsMpModel model.h5 # where: "nnet_bds" is the generated output file prefix # "BdsMpModel" is the generated C++ class name ---------------------------------------------------------------------- To install a trained model on a receiver you just need: - eigen-3.3-beta2.tar.gz - gen/some_file_out_gen.cpp - gen/some_file_out_gen.cpp.h - tfconvert_ops.h ---------------------------------------------------------------------- Things to investigate: - don't store all intermediate values in the class (although this is useful for debugging problems). Perhaps the compiler could do more optimizations? - investigate using Eigen Matrix instead of Tensor? (but what about 3D recurrent neural network inputs?) - split operations into multiple functions for better optimization?