How to use 'tensorflow gpu check' in Python

Every line of 'tensorflow gpu check' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
204def is_gpu_available():
205 from tensorflow.python.client import device_lib
206 local_device_protos = device_lib.list_local_devices()
207 gpu_list = [x.name for x in local_device_protos if x.device_type == 'GPU']
208 if len(gpu_list) > 0:
209 print("Tensorflow GPU:", gpu_list)
210 return True
211 else:
212 return False

Related snippets