Path: blob/master/site/en-snapshot/xla/tutorials/autoclustering_xla.ipynb
25118 views
Kernel: Python 3
Copyright 2019 The TensorFlow Authors.
In [ ]:
Classifying CIFAR-10 with XLA
This tutorial trains a TensorFlow model to classify the CIFAR-10 dataset, and we compile it using XLA.
You will load and normalize the dataset using the TensorFlow Datasets (TFDS) API. First, install/upgrade TensorFlow and TFDS:
In [ ]:
In [ ]:
In [ ]:
We define the model, adapted from the Keras CIFAR-10 example:
In [ ]:
We train the model using the RMSprop optimizer:
In [ ]:
Now let's train the model again, using the XLA compiler. To enable the compiler in the middle of the application, we need to reset the Keras session.
In [ ]:
On a machine with a Titan V GPU and an Intel Xeon E5-2690 CPU the speed up is ~1.17x.