Skip to content

Mesh summaries do not respect name scopes #3114

Open
@wchargin

Description

@wchargin

The docs for tensorboard.plugins.mesh.summary_v2.mesh say:

    Args:
      name: A name for this summary. The summary tag used for TensorBoard will
        be this name prefixed by any active name scopes.

But this is not accurate. Consider the following simple repro:

import tensorflow as tf
from tensorboard.plugins.mesh import summary_v2 as mesh_summary

tf.summary.create_file_writer("logs").set_as_default()

with tf.name_scope("foo"):
    with tf.name_scope("bar"):
        tf.summary.scalar("loss", 0.125, step=0)
        mesh_summary.mesh(
            "mymesh", [[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]], step=1
        )

This creates a properly scoped scalar summary, foo/bar/loss:

Screenshot of foo/bar/loss in the scalars dashboard

But the mesh summary that it creates is not scoped:

Screenshot of mymesh (no scope) in the mesh dashboard

And indeed the written data does not contain the scoped mesh tag name:

$ strings logs/*
brain.Event:2U
foo/bar/lossB
scalars@
mymesh_VERTEXB*
mesh
mymesh

This appears to be because the mesh summary code calls summary_scope
and enters its context manager but discards the yielded tag name:

summary_scope = (
getattr(tf.summary.experimental, "summary_scope", None)
or tf.summary.summary_scope
)
all_success = True
with summary_scope(name, "mesh_summary", values=tensors):

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions