Created
October 7, 2019 06:15
-
-
Save cozek/e47ce8e29b229fb79e1eb58ad36f1645 to your computer and use it in GitHub Desktop.
Check if keras is using the GPU
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/questions/44544766/how-do-i-check-if-keras-is-using-gpu-version-of-tensorflow/44547144 | |
# confirm TensorFlow sees the GPU | |
from tensorflow.python.client import device_lib | |
assert 'GPU' in str(device_lib.list_local_devices()) | |
# print(device_lib.list_local_devices()) | |
# confirm Keras sees the GPU | |
from keras import backend | |
assert len(backend.tensorflow_backend._get_available_gpus()) > 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment