官方TensorFlow2.0-GPU代码测试+官方TensorFlow1.x-GPU代码测试 并查看版本

TensorFlow2.0-GPU代码测试

import tensorflow as tf

#查看tensorflow版本
print(tf.__version__)

print('GPU', tf.test.is_gpu_available())

a = tf.constant(2.0)
b = tf.constant(4.0)
print(a + b)

成功如图:
在这里插入图片描述
在这里插入图片描述

TensorFlow1.x-GPU代码测试

import tensorflow as tf
tf.test.is_gpu_available()

在这里插入图片描述
在这里插入图片描述

发布了607 篇原创文章 · 获赞 809 · 访问量 10万+

猜你喜欢

转载自blog.csdn.net/qq_35456045/article/details/104666083