def set_gpu_fraction(sess=None, gpu_fraction=0.3):
 print ('  tensorlayer: GPU MEM Fraction %f' % gpu_fraction)
 gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction)
 sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
 return sess

def set_gpu_fraction ( sess = None , gpu_fraction = 0.3 ) : print ( '  tensorlayer: GPU MEM Fraction %f' % gpu_fraction ) gpu_options = tf . GPUOptions ( per_process_gpu_memory_fraction = gpu_fraction ) sess = tf . Session ( config = tf . ConfigProto ( gpu_options = gpu_options ) ) return sess
set the gpu memory fraction for the application .