AttributeError: module 'tensorflow.python.summary.summary' has no attribute 'FileWriter'
Solution 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)
Solution 2
If you are using tesorflow 2.0.0 version, use
writer = tf.summary.create_file_writer("/tmp/tfvgg")
instead of writer = tf.summary.FileWriter("/tmp/tfvgg", sess.graph)
.
DanielSon
Studying Computer Science, Machine Learning and Data Mining
Updated on June 07, 2022Comments
-
DanielSon almost 2 years
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 othersummary
methods?