In Tensorflow 2.0, my issue was resolved by setting the memory growth. ConfigProto is deprecated in TF 2.0, I used tf.config.experimental. My computer specs are:
- OS: Ubuntu 18.04
- GPU: GeForce RTX 2070
- Nvidia Driver: 430.26
- Tensorflow: 2.0
- Cudnn: 7.6.2
- Cuda: 10.0
The code I used was:
physical_devices = tf.config.experimental.list_physical_devices('GPU')
assert len(physical_devices) > 0, "Not enough GPU hardware devices available"
config = tf.config.experimental.set_memory_growth(physical_devices[0], True)