profile_demo.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:tensorboard 作者: tensorflow 项目源码 文件源码
def dump_data(logdir):
  """Dumps plugin data to the log directory."""
  plugin_logdir = plugin_asset_util.PluginDirectory(
      logdir, profile_plugin.ProfilePlugin.plugin_name)
  _maybe_create_directory(plugin_logdir)

  for run in profile_demo_data.RUNS:
    run_dir = os.path.join(plugin_logdir, run)
    _maybe_create_directory(run_dir)
    if run in profile_demo_data.TRACES:
      with open(os.path.join(run_dir, 'trace'), 'w') as f:
        proto = trace_events_pb2.Trace()
        text_format.Merge(profile_demo_data.TRACES[run], proto)
        f.write(proto.SerializeToString())
    shutil.copyfile('tensorboard/plugins/profile/profile_demo.op_profile.json',
                    os.path.join(run_dir, 'op_profile.json'))

  # Unsupported tool data should not be displayed.
  run_dir = os.path.join(plugin_logdir, 'empty')
  _maybe_create_directory(run_dir)
  with open(os.path.join(run_dir, 'unsupported'), 'w') as f:
    f.write('unsupported data')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号