title: How to ensure tensorflow is using the GPU
body: <p>I installed CUDA v9.2 and corresponding cuDNN manually to install tensorflow gpu
  But I realized that tensorflow 1.8.0 requires CUDA 9.0 so I ran</p>
  
  <pre><code>pip install tensorflow-gpu
  </code></pre>
  
  <p>from the anaconda prompt (base environment) where it automatically installed CUDA 9.0 and corresponding cuDNN. I started Spyder from the same command prompt.
  So here is my code in Python 3.6 where I'm using keras and tensorflow to train using 8000 odd images - </p>
  
  <pre><code># Convolutional Neural Networks
  # Part 1 - Building the CNN
  # Not important
  
  # Part 2- Fitting the CNN to the images - 
  from keras.preprocessing.image import ImageDataGenerator
  train_datagen = ImageDataGenerator(
          rescale=1./255,
          shear_range=0.2,
          zoom_range=0.2,
          horizontal_flip=True)
  
  test_datagen = ImageDataGenerator(rescale=1./255)
  
  training_set = train_datagen.flow_from_directory(
          'dataset/training_set',
          target_size=(64, 64),
          batch_size=32,
          class_mode='binary')
  
  test_set = test_datagen.flow_from_directory(
          'dataset/test_set',
          target_size=(64, 64),
          batch_size=32,
          class_mode='binary')
  with tf.device("/gpu:0"):   # Notice THIS
      classifier.fit_generator(
              training_set,
              steps_per_epoch=8000,
              epochs=25,
              validation_data=test_set,
              validation_steps=2000)
  </code></pre>
  
  <p>Notice that right before fitting the dataset at the end, I put it inside</p>
  
  <pre><code>with tf.device("/gpu:0"):
  </code></pre>
  
  <p>I think this should ensure that it uses the GPU for training? I'm not sure because changing " gpu:0 " to " cpu:0 " gives the exact same time (18-20 minutes per epoch) for training. How do I ensure that tensorflow in Spyder uses my GPU ?</p>
  
  <p>I have a NVIDIA GTX 970 so its CUDA compatible.
  Also I'm using python 3.6 , is that a problem ?
  Should I create a seperate Python 3.5 environment and install tensorflow-gpu in that similarly and try ?</p>