小编Har*_*han的帖子

在 Tensorboard 中使用 Tensorflow v2.0 显示图形

以下代码使用 TensorFlow v2.0

import tensorflow as tf    
a = tf.constant(6.0, name = "constant_a")
b = tf.constant(3.0, name = "constant_b")
c = tf.constant(10.0, name = "constant_c")
d = tf.constant(5.0, name = "constant_d")    
mul = tf.multiply(a, b , name = "mul")
div = tf.divide(c,d, name ="div")
addn = tf.add_n([mul, div], name = "addn")

writer = tf.summary.create_file_writer("./tensorboard")

with writer.as_default():
     tf.summary.scalar("addn_harsha", addn, step=1)
Run Code Online (Sandbox Code Playgroud)

我是 Python 和 Tensorflow 的新手。我可以使用上面的代码在 Tensorboard 中创建标量。但我无法生成相同的图表。

在 TensorFlow v1.0 中,我们这样写: writer = tf.summary.FileWriter("./tensorboard", sess.graph)

但是在 TensorFlow v2.0 中,不再使用 Session。那么,我们可以编写什么来使用 TensorFlow …

machine-learning python-3.x tensorflow tensorboard

6
推荐指数
1
解决办法
1643
查看次数