Keras with tensorflow GPU


I haven't seen this information explicitly on the web rather than issues reported. When using a virtual environment where you have installed tensorflow-gpu and you install keras, keras will install the CPU tensorflow version. By doing this it won't be possible to use the GPU. Thus, the correct order to use keras with the GPU tensorflow version is:

  1. Install keras
  2. Install tensorflow-gpu


After this, the default backend for keras will be tensorflow and will work with the GPU.

To validate if you are using the GPU [1] :
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))


Comentarios

Entradas populares de este blog

Deep neural networks visualization

Google Chart Sankey Diagram online for non software developers

Tensorflow Batch norm not working