tensorflow2.0版本
错误和cudnn有关,排除了cuda和cudnn的版本问题,在网上查了一下,应该是GPU被占用,所以无法使用,需要在代码里面添加几行语句,设置GPU的按需分配
添加代码
import tensorflow as tf
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0
tf.config.experimental.set_memory_growth(physical_devices[0], True)
assert tf.config.experimental.get_memory_growth(physical_devices[0]) == True
原文链接:https://blog.csdn.net/He110__W0r1d/article/details/102961611