AttributeError: module 'tensorflow.python.summary.summary' has no attribute 'FileWriter'

寵の児 提交于 2020-01-24 07:24:48

问题


I'm getting this error, although everywhere I've looked file_writer = tf.summary.FileWriter('/path/to/logs', sess.graph) is mentioned as the correct implementation of this and this.

Here is the error:

Traceback (most recent call last): File "tfvgg.py", line 304, in writer = tf.summary.FileWriter("/tmp/tfvgg", sess.graph) AttributeError: module 'tensorflow.python.summary.summary' has no attribute 'FileWriter'

Here is the code I'm using:

# init
sess = tf.Session()
writer = tf.summary.FileWriter("/tmp/tfvgg", sess.graph)
init = tf.initialize_all_variables()
sess.run(init)

Has there been a change to the correct way to use FileWriter as there has been with other summary methods?


回答1:


For future reference of anyone in the same situation, changing tf.summary.FileWriter() to tf.train.SummaryWriter() solved this issue and allowed for graph visualisation in Tensorboard. As I thought, it seems like FileWriter may be deprecated (although it does oddly still appear when searching through tf methods in the IDE)



来源:https://stackoverflow.com/questions/43304270/attributeerror-module-tensorflow-python-summary-summary-has-no-attribute-fil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!