查看tensorflow是否支持GPU,以及测试程序

2022-09-03 21:12:36 浏览数 (1)

测试程序

代码语言:javascript复制
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

是否支持GPU

代码语言:javascript复制
import tensorflow as tf
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
>>>
Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 960M, pci bus id: 0000:02:00.0, compute capability: 5.0
gpu

0 人点赞