jupyter运行有如下问题
UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
两种原因:
原因一.cudnn版本不匹配
原因二、显卡内存分配不足
解决方案也有三种:
方案一:
降级tensorflow版本
pip install --upgrade tensorflowgpu==1.8.0
https://blog.csdn.net/loovelj/article/details/84995149?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.channel_param
tensorflow版本降至1.9.0
方案二:
在代码里增加显卡内存自动分配
同样也有两种做法:
方法1.在代码块首部加入
import os
os.environ['CUDA_VISIBLE_DEVICES'] = '/gpu:0'
方法2
在代码块首部加入
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)
方法3
//这两句加在sess = tf.Session()前
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
//在session内增加config = config
sess = tf.Session(config = config)