0

I'm facing an error with Tensorflow v2.1.0:

AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter

My code is:

import tensorflow as tf

a = tf.constant(5.0)
b = tf.constant(6.0)

c = a*b

sess = tf.compat.v1.Session()

File_Writer = tf.summary.FileWriter(r"C:\Users\Name\Desktop\TensorFlow\graph", sess.graph)

print(sess.run(c))

The output error is:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-19-898c56a41b1a> in <module>
      6 sess = tf.compat.v1.Session()
      7 
----> 8 File_Writer = tf.summary.FileWriter(r"C:\Users\Name\Desktop\TensorFlow\graph", sess.graph)
      9 
     10 print(sess.run(c))

AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter'

What shall I do to fix it?

1 Answer 1

2

Use tf.summary.create_file_writer('log_path')

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your reply! Although the error is no longer there, but it does not create "graph" folder with a file that I need to run it with tensorboard.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.