tensorflow RuntimeError:Graph is finalized and cannot be modified

  • Post author:
  • Post category:其他


有可能的致错原因

tf.summary.scalar(‘loss’,loss)

merged = tf.summary.merge_all()

#save

saver = tf.train.Saver(tf.global_variables())

sv = tf.train.Supervisor(logdir=xx,saver=saver)

with sv.managed_session(config=config) as sess:

这样写没有报上述错误

然而:下述顺序会报错

tf.summary.scalar(‘loss’,loss)

#save

saver = tf.train.Saver(tf.global_variables())

sv = tf.train.Supervisor(logdir=xx,saver=saver)

merged = tf.summary.merge_all()

with sv.managed_session(config=config) as sess:

可能的原因是:

https://stackoverflow.com/questions/41798311/tensorflow-graph-is-finalized-and-cannot-be-modified

中提到The root cause for your error seems to be that MonitoredTrainingSession has finalized (frozen) the graph and your

tf.global_variable_initializer()

is no longer able to modify it.

可能是saver中涉及冻结图标的操作,但是这和merge_all有何关系扔不懂:-D….



版权声明:本文为qq_17588383原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。