AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter'
AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter'
我在使用 Tensorflow v2.1.0 时遇到错误:
AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter
我的代码是:
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))
输出错误为:
---------------------------------------------------------------------------
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'
我该如何解决?
使用tf.summary.create_file_writer('log_path')
我在使用 Tensorflow v2.1.0 时遇到错误:
AttributeError: module 'tensorflow_core.summary' has no attribute 'FileWriter
我的代码是:
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))
输出错误为:
---------------------------------------------------------------------------
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'
我该如何解决?
使用tf.summary.create_file_writer('log_path')