def get_session():
tf.reset_default_graph()
tf_config = tf.ConfigProto(
inter_op_parallelism_threads=1,
intra_op_parallelism_threads=1)
# This was the default provided in the starter code.
#session = tf.Session(config=tf_config)
# Use this if I want to see what is on the GPU.
#session = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Use this for limiting memory allocated for the GPU.
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=0.5)
session = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
print("AVAILABLE GPUS: ", get_available_gpus())
return session
评论列表
文章目录