您的位置:首页 > 编程语言

TensorFlow2.0,GPU代码测试

2020-01-14 07:24 405 查看

TensorFlow2.0,GPU代码测试

代码如下

import tensorflow as tf
import os

os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'  # 不显示等级2以下的提示信息

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

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

结果

GPU True
tf.Tensor(6.0, shape=(), dtype=float32)
  • 点赞
  • 收藏
  • 分享
  • 文章举报
爱吃菠萝蜜 发布了10 篇原创文章 · 获赞 3 · 访问量 1152 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: