tf.ConfigProto一般用在創建session的時候用來對session進行參數配置
with tf.Session(config=tf.ConfigProto(...)...)
tf.ConfigProto()的參數
1. log_device_placement = True # 是否打印設備分配日志
2.allow_soft_placement = True # 如果你指定的設備不存在, 允許TF自動分配設備
舉例: tf.ConfigProto(log_device_placement = True, allow_soft_placement = True)
tfconfig = tf.ConfigProto()
tfconfig.gpu_options.allow_growth = True # 如果allow_growth為truth, 分配器不會指定少量的GPU容器,然后按需慢慢增加