Created
February 8, 2019 09:34
-
-
Save rohit-gupta/62a2e8b560cb5cd20e2d90607d15bb31 to your computer and use it in GitHub Desktop.
Limit GPU memory usage in Keras
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import keras.backend as K | |
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.25) | |
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options)) | |
K.set_session(sess) | |
## Use normally after this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment