Skip to content

Instantly share code, notes, and snippets.

@ravi9
Last active May 4, 2018 16:48
Show Gist options
  • Save ravi9/50c3d7e67de56759c3795460cb2b2059 to your computer and use it in GitHub Desktop.
Save ravi9/50c3d7e67de56759c3795460cb2b2059 to your computer and use it in GitHub Desktop.
Simple mnist example for using keras to save tracing info with TF
#Install requirements.
pip install virtualenv
virtualenv --python=/usr/bin/python2.7 keras_tracing
source keras_tracing/bin/activate
cd keras_tracing/
pip install keras
pip install -i https://pypi.anaconda.org/intel/simple tensorflow
#Clone mnist sample code
git clone https://github.com/ravi9/keras-trace-example.git
cd keras-trace-example
#Train a MNIST model
python mnist_train.py
#Run inference, model.predict() and save timeline tracing info
python mnist_inference.py
#The above command will save Tensorflow trace to: ./timeline_trace.json
#To view the trace:
#(1) Open Chrome browser.
#(2) Go to this url -- chrome://tracing
#(3) Click the load button.
#(4) Load the file ./timeline_trace.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment