Skip to content

Instantly share code, notes, and snippets.

@monklof
Created January 7, 2019 05:29
Show Gist options
  • Save monklof/438a33625e4a1340072667890279def9 to your computer and use it in GitHub Desktop.
Save monklof/438a33625e4a1340072667890279def9 to your computer and use it in GitHub Desktop.
tf_avaiable_gpu
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 if x.device_type == 'GPU']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment