问题
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