question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tensorflow 2.0 custom_scalar plugin for tensorboard

See original GitHub issue

To set layout for custom_layout plugin in tensorflow 1.x you should use method add_summary in FileWriter class. So the code should look like this:

with tf.summary.FileWriter(LOGDIR) as writer:
   layout_summary = summary_lib.custom_scalar_pb(...)
   writer.add_summary(layout_summary)

In tensorflow 2 add_summary method was removed. How can I set custom_scalar layout now? Is it a bug or a desired API change?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:5

github_iconTop GitHub Comments

2reactions
dcbrcommented, Dec 21, 2020

I managed to make the custom_scalar plugin work in TF2.3 as follows:

import tensorflow as tf
from tensorboard.plugins.custom_scalar import layout_pb2
from tensorboard.plugins.custom_scalar.summary import pb as custom_scalar_pb

writer = tf.summary.create_file_writer(LOGDIR)
layout = custom_scalar_pb(layout_pb2.Layout(...))
with writer.as_default():
    tensor = tf.constant(tf.make_ndarray(layout.value[0].tensor))
    tf.summary.write(layout.value[0].tag, tensor, step=0, metadata=layout.value[0].metadata)

It would however be nice to have native TF2 support for this, allowing us to write something along the lines tf.summary.custom_scalar(layout).

0reactions
nfeltcommented, Sep 27, 2021

This is still an open issue; I’ve transferred it to the TensorBoard repository since that’s a better place to track it, since if we were to add a TF 2.0 native summary op for custom scalars, it would be defined in TensorBoard’s codebase.

Right now, we haven’t worked on the custom scalars dashboard in quite a while due to low usage and a general desire to approach this kind of feature differently (allowing UI-driven configuration rather than requiring the layout to be hardcoded in the written summaries).

At this point, I’d recommend using the workaround from https://github.com/tensorflow/tensorboard/issues/5343#issuecomment-749066283. (There is also the tf.summary.experimental.write_raw_pb() approach used in the updated demo code as of https://github.com/tensorflow/tensorboard/pull/5011, if you have a serialized version of the v1 summary proto.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

TensorBoard Scalars: Logging training metrics in Keras
You will learn how to use the Keras TensorBoard callback and TensorFlow Summary APIs to visualize default and custom scalars.
Read more >
tensorboardX - PyPI
TensorBoardX lets you watch Tensors Flow without Tensorflow.
Read more >
tensorboard Changelog - PyUp.io
Fix for run table overlapping text in npmi plugin (5468) ... [debugger-v2-tutorial]: https://www.tensorflow.org/tensorboard/debugger_v2
Read more >
keras tensorboard, keras tensorboard example, keras print learning ...
In general, to log a custom scalar, you need to use tf.summary.scalar() with a file writer. TensorFlow version : 2.0.0; TensorFlow Keras version:...
Read more >
tensorboardX - Python Package Health Analysis - Snyk
tensorboardX. v2.5.1. TensorBoardX lets you watch Tensors Flow without Tensorflow For more information about how to use this package see README.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found