How could I release gpu memory of keras

Prevents tensorflow from using up the whole gpu

import tensorflow as tf
config = tf.ConfigProto()
config.gpu_options.allow_growth=True
sess = tf.Session(config=config)

This code helped me to come over the problem of GPU memory not releasing after the process is over. Run this code at the start of your program. Thanks.