[Solved] TF2.4 Error: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize

First, check whether the CUDA version and cudnn version are aligned.

Version number view:

Note that CUDA indicates the minimum compatibility. For example, version 2.4 and above 11.0 are OK. My side is 11.5, and there is no problem

The error on my side is caused by insufficient video memory

For the error of insufficient video memory, add the following code.

import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.compat.v1.InteractiveSession(config=config)

Read More: