mat*_*ick 3 tensorflow tensorboard tensorflow2.0
我在做这个
# eager on
tf.summary.trace_on(graph=True, profiler=True)
tf.summary.trace_export('stuff', step=1, profiler_outdir='output')
# ... call train operation
tf.summary.trace_off()
Run Code Online (Sandbox Code Playgroud)
配置文件部分显示在张量板上,但还没有图表。
请在此处找到我使用 Tf2.0 创建图形并在 tensorboard 中对其进行可视化的 github gist。此外,有关更多信息,请访问以下链接。
下面提到了相同的代码:
!pip install tensorflow==2.0.0-beta1
import tensorflow as tf
# The function to be traced.
@tf.function
def my_func(x, y):
# A simple hand-rolled layer.
return tf.nn.relu(tf.matmul(x, y))
# Set up logging.
logdir = './logs/func'
writer = tf.summary.create_file_writer(logdir)
# Sample data for your function.
x = tf.random.uniform((3, 3))
y = tf.random.uniform((3, 3))
# Bracket the function call with
# tf.summary.trace_on() and tf.summary.trace_export().
tf.summary.trace_on(graph=True, profiler=True)
# Call only one tf.function when tracing.
z = my_func(x, y)
with writer.as_default():
tf.summary.trace_export(
name="my_func_trace",
step=0,
profiler_outdir=logdir)
%load_ext tensorboard
%tensorboard --logdir ./logs/func
Run Code Online (Sandbox Code Playgroud)
如果回答有帮助,请点赞。谢谢!
| 归档时间: |
|
| 查看次数: |
2242 次 |
| 最近记录: |