Ujj*_*wal 6 tensorflow tensorflow2.0
我想简单地定义一个模型,并在TensorBoard中可视化其图形以进行初始体系结构检查。因此,我不想为此目的进行任何计算。
在TensorFlow 1.X中,在一个tf.Session()我可以简单地flush()编写摘要文件的地方轻松实现。
在TensorFlow 2.0中没有tf.Session(),因此问题是如何实现呢?
以下是示例代码。为了在TensorBoard中编写图结构,我需要添加什么?
from nets import i3d
import tensorflow as tf
def i3d_output(model, x):
out, _ = model(x)
return out
tf.compat.v1.disable_eager_execution()
x = tf.random.uniform(shape=(4,179,224,224,3))
model = i3d.InceptionI3d()
net = i3d_output(model, x)
train_summary_writer = tf.summary.create_file_writer('/home/uujjwal/bmvc2019')
Run Code Online (Sandbox Code Playgroud)
在图形模式下使用:
from tensorflow.python.summary.writer.writer import FileWriter
FileWriter('logs/', graph=tf.compat.v1.get_default_graph()).close()
Run Code Online (Sandbox Code Playgroud)
或这个:
tf.compat.v1.summary.FileWriter('log/', graph=tf.compat.v1.get_default_graph()).close()
Run Code Online (Sandbox Code Playgroud)
不需要在开幕式上。
| 归档时间: |
|
| 查看次数: |
531 次 |
| 最近记录: |