How to use 'tensorflow disable gpu' in Python

Every line of 'tensorflow disable gpu' 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
this disclaimer
152def gpu_available_in_session():
153 sess = tfv1.get_default_session()
154 for dev in sess.list_devices():
155 if dev.device_type.lower() == 'gpu':
156 return True
157 return False
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code


Related snippets