tensorflow使用gpu的解决方案

感觉tensorfloe-gpu限制比较多

探索出来的一种可行办法:

1.安装miniconda(anaconda不行,如果本机装了的话,建议卸载)

2.在base环境下安装conda install tensorflow=2.0.0    

这里我试过最新的2.3版本,不太行。2.0.0版本会附带装上cudatoolkit(10.0.130)和cudnn(7.6.5)

比较简洁

然后在vscode下选择对应的ipython kernel

3.测试gpu版本是否可用

import tensorflow as tf
if tf.test.gpu_device_name():
    print('Default GPU Device: {}'.format(tf.test.gpu_device_name()))
else:
    print("Please install GPU version of TF")

出现上述结果,则证明可用

扫描二维码关注公众号,回复: 12273966 查看本文章

猜你喜欢

转载自blog.csdn.net/weixin_43642491/article/details/108817568