When I\'m trying to use TensorFlow with Keras using the gpu, I\'m getting this error message:
C:\\Users\\nicol\\Anaconda3\\envs\\tensorflow\\lib\\site-packag
It's a simple fix, but it was a nightmare to figure it all out
On Windows I found the Keras install in Anaconda3\Lib\site-packages\keras
sources:
https://www.tensorflow.org/guide/using_gpu
https://github.com/keras-team/keras/blob/master/keras/backend/tensorflow_backend.py
Find the following in your keras/tensorflow_backend.py file you'll add config.gpu_options.allow_growth= True in both places
if _SESSION is None:
if not os.environ.get('OMP_NUM_THREADS'):
config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.allow_growth=True
else:
num_thread = int(os.environ.get('OMP_NUM_THREADS'))
config = tf.ConfigProto(intra_op_parallelism_threads=num_thread,
allow_soft_placement=True)
config.gpu_options.allow_growth=True
_SESSION = tf.Session(config=config)
session = _SESSION