Here is my code:
tf.enable_eager_execution()
writer = tf.summary.FileWriter(result_path+'logs/')
for epoch in range(epochs):
if step_count % 100 == 0:
ref = tf.summary.image("G_ref/{}".format(step_count), image_batch, max_outputs=12)
merge_sum = tf.summary.merge([ref])
sum = sess.run(merge_sum)
writer.add_summary(sum, step_count)
writer.flush()
Error:
Traceback (most recent call last):
File "main.py", line 60, in <module>
writer = tf.compat.v1.summary.FileWriter(result_path+'logs/')
File "/home/jieyang/.conda/envs/tensorflow/lib/python3.7/site-packages/tensorflow_core/python/summary/writer/writer.py", line 360, in __init__
"tf.summary.FileWriter is not compatible with eager execution. "
RuntimeError: tf.summary.FileWriter is not compatible with eager execution. Use tf.contrib.summary instead.
There are 2

在使用TensorFlow时遇到错误:RuntimeError: tf.summary.FileWriter不兼容Eager Execution。有两种解决方案:1. 通过tf.disable_eager_execution()禁用Eager Execution,但此方法无法解决因启用Eager Execution引发的问题;2. 按照错误提示,改用tf.contrib.summary。有关tf.contrib.summary的文档可参考链接:http://man.hubwiz.com/docset/TensorFlow.docset/Contents/Resources/Documents/api_docs/python/tf/contrib/summary.html 和 http://tensorflow.biotecan.com/python/Python_1.8/tensorflow.google.cn/api_docs/python/tf/contrib/summary/image.html。

5万+

被折叠的 条评论
为什么被折叠?



