Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 976
DanielSon Avatar asked Apr 09 '17 07:04

DanielSon


1 Answers

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)

like image 94
DanielSon Avatar answered Oct 23 '22 05:10

DanielSon