Tensorflow中查看gpu是否可用
使用tf.test.is_gpu_available()
函数可直接返回
import tensorflow as tf
tf.test.is_gpu_available()
Tensorflow测试程序
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
使用tf.test.is_gpu_available()
函数可直接返回
import tensorflow as tf
tf.test.is_gpu_available()
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))