赞
踩
因为自己在实现yolo5的过程中其中所需要的的环境是cuda10.1但是在之前安装的是10.0,所以只有自己折腾一下。但是cuda10.1貌似很难安装tensorflow1.X版本,在查阅资料并亲测过之后写下。
二、电脑环境
1.win10专业版
2.CUDA=10.1
3.显卡=1080TI
4.vs2015
三、安装
1.具体的安装步骤就不在这做详细说明,具体可以去看https://blog.csdn.net/weixin_43218120/article/details/107708082
在上面的博客中有详细说明。
2.问题解决
解决安装tensorflow-gpu1.X版本问题只需要在安装tensorflow-gpu之前安装cudatoolkit=10.0的包,具体的安装命令如下:
conda install cudatoolkit=10.0
1
在安装cudatoolkit之后再进行安装tensorflow就成功。
四、测试
1.测试代码
- import tensorflow as tf
- hello = tf.constant('Hello, TensorFlow!')
- sess = tf.Session()
- print(sess.run(hello))
- print(tf.test.is_gpu_available())
-
- print(tf.__version__)
或者
- import tensorflow as tf
- with tf.device('/gpu:0'):
- a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
- b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
- c = tf.matmul(a, b)
-
- with tf.Session() as sess:
- print (sess.run(c))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。