产生原因:

tensorflow和cuda版本不对应

通过下面的网址可以查看tensorflow和cuda的版本映射关系

https://tensorflow.google.cn/install/source#gpu

 

 解决方法:

查看本机tensorflow的版本

打开命令行,输入:

pip show tensorflow

 有些版本需要tensorflow-gpu,如上图最后一行,通过下面的指令查看

pip show tensorflow-gpu

查看本机cuda版本

打开

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA

查看这个文件夹下的版本

下载tensorflow

pip install tensorflow==2.0.0

下载cuda

在浏览器下查找特定版本的cuda,然后下载

 

测试程序

import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
print(tf.__version__)
a = tf.constant(1.)
b = tf.constant(2.)
print(a+b)
print('GPU:', tf.test.is_gpu_available())

 零零碎碎

相关链接

相关链接

安装cuda

下载10.1版本的cuda

查看本机cuda版本

安装tensorflow:

pip install tensorflow-gpu==2.6.0

GitHub 加速计划 / te / tensorflow
33
4
下载
一个面向所有人的开源机器学习框架
最近提交(Master分支:1 个月前 )
4f64a3d5 Instead, check for this case in `ResolveUsers` and `ResolveOperand`, by querying whether the `fused_expression_root` is part of the `HloFusionAdaptor`. This prevents us from stepping into nested fusions. PiperOrigin-RevId: 724311958 3 个月前
aa7e952e Fix a bug in handling negative strides, and add a test case that exposes it. We can have negative strides that are not just -1, e.g. with a combining reshape. PiperOrigin-RevId: 724293790 3 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐