环境:
tensorflow 2.4.0
解决过程:
Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
我一度以为是 cuDNN 安装得有问题,后来发现 GPU 空间不够用了,网上有一些方法,大多是 tensorflow 1.x 版本的,好不容易找到个 tensorflow 2.0 的, 如下:
import tensorflow as tf
import keras
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
tf.config.experimental.set_memory_growth(physical_devices[0], True)
但是我放上去又报错,试了一下又报错:
RuntimeError: Physical devices cannot be modified after being initialized
这个把刚才那段代码放到文件最顶上的就行了, 处理完再 import 别的包~
网友评论