tf.Graph.finalize()使用

一,tf.Graph.finalize()
在调用tf.Graph.finalize()之后,不能向计算图 g 添加新操作。 此方法用于确保在多个线程之间共享时能像计算图添加任何操作,例如使用 tf.train.QueueRunner 的时候。
二,实例,加载完模型后,禁止图添加操作。

g = tf.Graph()
with g.as_default():
    model = inference_wrapper.InferenceWrapper()
    tore_fn = model.build_graph_from_config(model_config,   track_config, checkpoint)
g.finalize()

你可能感兴趣的:(tensorflow)