AI/TensorFlow & PyTorch

[TensorFlow] This is probably because cuDNN failed to initialize 오류

byunghyun23 2021. 4. 6. 16:05

"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."

 

GPU를 사용하여 합성곱 신경망 모델로 학습할 때, 자주 발생하는 오류입니다.

해당 오류는 VRAM과 관련이 있습니다. 

아래 코드를 작성해주면 해결됩니다.

 

# set gpu
gpus = tf.config.experimental.list_physical_devices('GPU')
if gpus:
    try:
        for gpu in gpus:
            tf.config.experimental.set_memory_growth(gpu, True)
        # logical_gpus = tf.config.experimental.list_logical_devices('GPU')
        # print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
    except RuntimeError as e:
        print(e)