tensorflow-gpu版linux端安装成功检验

检验代码:

import tensorflow as tf
a=tf.test.is_built_with_cuda()
b=tf.test.is_gpu_available(cuda_only=False,min_cuda_compute_capability=None)
print(a)
print(b)

执行这段代码应该显示为:

检验代码2:

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

安装成功的正确结果应该为:

验证环境:

tensorflow-gpu1.15.0

原文地址:https://www.cnblogs.com/acm-icpcer/p/12860163.html