• Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

Internal: cuDNN launch failure: input shape ([1,3,2048,2048]) node bn_data/FusedBatchNorm

Cause analysis,

TensorFlow: cuDNN launch failure: input Shape TensorFlow: cuDNN launch failure: input shape

Changing cudNN versions doesn’t help either.

In fact, it is more likely to be a problem with the TensorFlow video memory configuration (in fact, there is no evidence, but it can be ruled out in this way, so this factor should be the cause of the maximum likelihood)

The solution

Add an on-demand video memory allocation configuration to your code:

Plan 1

 con = tf.ConfigProto()
 con.gpu_options.allow_growth = True
 keras.backend.tensorflow_backend.set_session(tf.Session(config=con)) 
Copy the code

Scheme 2

os.environ['TF_FORCE_GPU_ALLOW_GROWTH'] = 'true'
Copy the code

Same principle, just a different way of writing it.