Skip to content

Instantly share code, notes, and snippets.

@sizhky
Last active August 6, 2020 05:57
Show Gist options
  • Save sizhky/f4c54b06fda19b9a8c65c3692a0825fa to your computer and use it in GitHub Desktop.
Save sizhky/f4c54b06fda19b9a8c65c3692a0825fa to your computer and use it in GitHub Desktop.
Prevents Tensorflow from hogging all the GPU resources
import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)
import tensorflow as tf
config = tf.compat.v1.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.compat.v1.Session(config=config)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment