需要环境
Anaconda
CUDA
cuDNN
注:tensorflow1.4用的是cuda8,cudnn6;tensorflow用的是cuda9,cudnn7,选择版本时要注意
CUDA安装
首先确认你的...我用的是tensorflow1.4,因此cuda需要安装8.0版本的,安装9.0版本会报错,提示dll文件找不到下载地址
注:安装前需要先安装显卡驱动,可以去英伟达官网,下载GeForce Experience...安装tensorflow-gpu
使用命令pip install tensorflow-gpu
测试代码
运行代码可以看到,使用的是gpu而不是cpu了!!!...import tensorflow as tf
# Creates a graph.
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