Skip to content Skip to sidebar Skip to footer

'module' Object Has No Attribute 'summarywriter'

I'm using Tensorflow version 0.12.head with Python 2.7 on a linux CentOS 7 and when I run this: import tensorflow as tf a = tf.constant(5, name='input_a') b = tf.constant(3, name=

Solution 1:

tf.train.SummaryWriter is deprecated, instead use tf.summary.FileWriter.

Adding Summaries to Event Files

It will be removed after 2016-11-30. Instructions for updating: Please switch to tf.summary.FileWriter. The interface and behavior is the same; this is just a rename.

<TF Official Migration Page> ✳︎ includes all current deprecated/renamed functions ✳︎

Solution 2:

In a new version of TF, all summary functions were renamed.

Summary functions have been consolidated under the tf.summary namespace.

 Deprecated                                               Replacement
----------------------------------------------------------------------------------
 tf.audio_summary                                         tf.summary.audio
 tf.contrib.deprecated.histogram_summary                  tf.summary.histogram
 tf.contrib.deprecated.scalar_summary                     tf.summary.scalar
 tf.histogram_summary                                     tf.summary.histogram
 tf.image_summary                                         tf.summary.image
 tf.merge_all_summaries                                   tf.summary.merge_all
 tf.merge_summary                                         tf.summary.merge
 tf.scalar_summary                                        tf.summary.scalar
 tf.train.SummaryWriter                                   tf.summary.FileWriter
----------------------------------------------------------------------------------

Solution 3:

i had the same problem...i am using pything 3.5.2...see solution below...hope this works for you..it did for me (it will create a log in your tmp folder):

import tensorflow as tf
a = tf.constant(5, name="input_a")
b = tf.constant(3, name="input_a")
c = tf.multiply(a,b, name="mul_c")
d = tf.add(a,b, name="add_d")
e = tf.add(c,d, name="add_e")

sess = tf.Session()
sess.run(e)
output = sess.run(e)

writer = tf.summary.FileWriter('/tmp/tensorflow_logs', graph=sess.graph)

print(sess.run(e))

Solution 4:

import tensorflow as tf
a = tf.constant(5, name="input_a")
b = tf.constant(3, name="input_a")
c = tf.multiply(a,b, name="mul_c")
d = tf.add(a,b, name="add_d")
e = tf.add(c,d, name="add_e")

sess = tf.Session()
sess.run(e)
output = sess.run(e)

writer = tf.summary.create_file_writer('/tmp/tensorflow_logs', graph=sess.graph)

print(sess.run(e))

Solution 5:

This is what worked for me.

tf.summary.create_file_writer('/pnplogs')

create_file_writer() creates a summary file writer for the given log directory (which in my case is pnplogs)

Read in TensorFlow documentation

Post a Comment for "'module' Object Has No Attribute 'summarywriter'"