# -*- coding: utf-8 -*-
import tensorflow as tf
import os
os.environ['CUDA_VISIBLE_DEVICES'] = "0"
hello = tf.constant('Hello, tensorflow')
sess = tf.Session()
# 打印当前tf的版本号
print(tf.__version__)
# 返回True,说明是可用的
print(tf.test.is_gpu_available())
如何确定tensorflow的版本号,以及当前机器的gpu是否可用
最新推荐文章于 2024-06-30 15:11:51 发布