报错信息
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.

我的配置
tensorflow1.12
GTX1060
CUDA 10.0
cudnn 7.6.4

方法一:可靠粗暴
将tensorflow1.12替换为tensorflow1.8.0或者1.9.0
而且不能使用conda命令安装

pip install tensorflow-gpu==1.8.0

方法二:简单有效
建立Session时,将代码修改为

  config = tf.ConfigProto()
  config.gpu_options.allow_growth = True
  sess = tf.Session(config=config)

最好用方法二吧,毕竟现在tf2.0都出来了,降低版本不能长久~