tensorflow测试gpu是否可用
查看是否有GPU:import tensorflow as tfgpu_device_name = tf.test.gpu_device_name()print(gpu_device_name)查看GPU是否可用,返回 True 或者 Falsetf.test.is_gpu_available()from tensorflow.python.client import device_lib# 列出
·
查看是否有GPU:
import tensorflow as tf
gpu_device_name = tf.test.gpu_device_name()
print(gpu_device_name)
查看GPU是否可用,返回 True 或者 False
tf.test.is_gpu_available()
from tensorflow.python.client import device_lib
# 列出所有的本地机器设备
local_device_protos = device_lib.list_local_devices()
# 打印
# print(local_device_protos)
# 只打印GPU设备
[print(x) for x in local_device_protos if x.device_type == 'GPU']
更多推荐
所有评论(0)