Last active
February 12, 2020 12:59
-
-
Save Puzer/c262e3c51fcbdf2e398bdaa2ba420c14 to your computer and use it in GitHub Desktop.
Limit GPU memory
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
# https://www.tensorflow.org/programmers_guide/using_gpu#allowing_gpu_memory_growth | |
import tensorflow as tf | |
from keras.backend.tensorflow_backend import set_session | |
config = tf.ConfigProto() | |
config.gpu_options.allow_growth = True | |
config.gpu_options.per_process_gpu_memory_fraction = 0.5 | |
sess = tf.Session(config=config) | |
set_session(sess) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment