solution:
config = tf.ConfigProto()
config.gpu_options.allow_growth = True
session = tf.Session(config=config, ...)
there are also such (fixed allocation):
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.333)
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
Remember to close other programs that use video memory!
Second:
When training, testing Tensorflow, Keras code, could not create cudnn handle: CUDNN_STATUS_NOT_INITIALIZED, error retrieving driver version: Unimplemented: kernel reported driver version not implemented on Windows, could not destroy cudnn handle: CUDNN_STATUS_BAD_PARAM, etc. . Just add the following code to it.
import tensorflow as tf
from keras import backend as K
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
K.set_session(sess)
Similar Posts:
- Error in calling GPU by keras or tensorflow: blas GEMM launch failed
- Failed to get convolution algorithm. This is probably because cuDNN failed to initialize
- “Failed to get convolution algorithm. This is probably because cuDNN failed to initialize”
- [Solved] TensorFlow Error: InternalError: Failed copying input tensor
- AttributeError: module ‘tensorflow’ has no attribute ‘Session’
- [Solved] Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- Tensorflow reported an error when using session module: attributeerror: module ‘tensorflow’ has no attribute ‘session’, which has been solved
- The solution of CUDA error: out of memory in yolo3 training
- [Solved] Python TensorFlow Error: ‘tensorflow.compat.v2.__internal__’ has no attribute ‘tf2’
- ImportError: cannot import name’e.g. utils’from’tensorflow.as.utils’ 38382;’ 39064;