Tensorflow Error
tensorflow.python.framework.errors_impl.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.
Solution
- shell
export CUDA_VISIBLE_DEVICES=0
- for tf 2
import os
os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
- for tensorflow-gpu v1.8
from tensorflow.compat.v1 import ConfigProto
from tensorflow.compat.v1 import InteractiveSession
config = ConfigProto()
config.gpu_options.allow_growth = True
session = InteractiveSession(config=config)