又很多学者可能会遇到这样的问题!!
当运行这份代码确定是否已经配置完成的时候,可能会出现GPU:FALSE的问题!和
os.environ['TF_CPP_MIN_LOG_LEVEL']="2" 无效的问题!接下来给大家解决!!!
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']="2"
a = tf.constant(1.)
b = tf.constant(2.)
print(a+b)
print('GPU:', tf.test.is_gpu_available())

1、当GPU出现FALSE的时候,我们用到的平台如果是pycharm的话,我们可以去安装tensorflow-gpu的安装包:

2、os.environ['TF_CPP_MIN_LOG_LEVEL']="2" 是为了运行时不出现过多的异常显示等等!!如果无效就将其写在impor tensorflow as tf 前面:
import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = "2"
import tensorflow as tf
a = tf.constant(1.)
b = tf.constant(2.)
print(a + b)
print('GPU:', tf.test.is_gpu_available())
