使用 tensorflow2,我尝试使用函数调用 tf.summary.trace_export() 记录 tensorflow 执行并在 tensorboard 图中查看它。但是,在调用时tf.summary.trace_export(name="my_func_trace", step=0, profiler_outdir=logdir),错误为
tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: logs/func/20191105-014756\plugins\profile\2019-11-05_01-47-57; No such file or directory
Run Code Online (Sandbox Code Playgroud)
除了使用创建文件编写器之外,我是否需要手动创建 /plugin/profile/
stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
logdir = 'logs/func/%s' % stamp
writer = tf.summary.create_file_writer(logdir)
Run Code Online (Sandbox Code Playgroud)
当我尝试执行 tensorflow.org ( https://www.tensorflow.org/tensorboard/graphs#graphs_of_tffunctions ) 中给出的示例时,也会出现同样的错误
这是我的 tensorflow 简单代码:
import tensorflow as tf
from datetime import datetime
stamp = datetime.now().strftime("%Y%m%d-%H%M%S")
logdir = './logs/tensor-constants/%s' % stamp
writer = tf.summary.create_file_writer(logdir)
a = tf.constant(1, dtype=tf.int32, shape=(), name='a')
b = tf.constant(2, dtype=tf.int32, shape=(), name='b')
tf.summary.trace_on(graph=True, profiler=True)
add …Run Code Online (Sandbox Code Playgroud)