怎么查看keras 或者 tensorflow 正在使用的GPU

from keras import backend as K
K.tensorflow_backend._get_available_gpus()



from tensorflow.python.client import device_lib
import tensorflow as tf

print(device_lib.list_local_devices())
print(tf.test.is_built_with_cuda())


import tensorflow as tf
print (tf.__version__)
if tf.test.gpu_device_name():
    print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
    print("Please install GPU version of TF")



posted @ 2020-08-12 09:11  kpwong  阅读(625)  评论(0编辑  收藏  举报