Testing GPU usage of Tensorflow

Use the following code to test if tensorflow-gpu is able to utilize GPU. This is for tensorflow 1.10.0.

import tensorflow as tf
import numpy as np

xx = np.random.normal(0,100,1200)
yy = np.random.normal(0,100,1200)

from tensorflow.python.client import device_lib

def get_available_gpus():
local_device_protos = device_lib.list_local_devices()
return [x.name for x in local_device_protos]

print(get_available_gpus())