Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR

Juniarto Samsudin
1 min readJun 22, 2020

--

I run into this nasty error code when trying to execute TensorFlow or Keras python code.

Here is the solution:

Use allow_growth memory option in TensorFlow and Keras, before your code.

For Keras

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

sess = tf.compat.v1.Session(config=config)
tf.compat.v1.keras.backend.set_session(sess)

For TensorFlow

import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth = True
config.log_device_placement = True
sess = tf.compat.v1.Session(config=config)

--

--

Responses (2)