code: def create_layout_summary():
      return cs_summary.pb(
          layout_pb2.Layout(
              category=[
                  layout_pb2.Category(
                      title="losses",
                      chart=[
                          layout_pb2.Chart(
                              title="losses",
                              multiline=layout_pb2.MultilineChartContent(
                                  tag=[r"loss(?!.*margin.*)"],
                              ),
                          ),
                          layout_pb2.Chart(
                              title="baz",
                              margin=layout_pb2.MarginChartContent(
                                  series=[
                                      layout_pb2.MarginChartContent.Series(
                                          value="loss/baz",
                                          lower="loss/baz_lower",
                                          upper="loss/baz_upper",
                                      ),
                                  ],
                              ),
                          ),
                      ],
                  ),
                  layout_pb2.Category(
                      title="trig functions",
                      chart=[
                          layout_pb2.Chart(
                              title="wave trig functions",
                              multiline=layout_pb2.MultilineChartContent(
                                  tag=[
                                      r"trigFunctions/cosine",
                                      r"trigFunctions/sine",
                                  ],
                              ),
                          ),
                          # The range of tangent is different. Give it its own chart.
                          layout_pb2.Chart(
                              title="tan",
                              multiline=layout_pb2.MultilineChartContent(
                                  tag=[r"trigFunctions/tangent"],
                              ),
                          ),
                      ],
                      # This category we care less about. Make it initially closed.
                      closed=True,
                  ),
              ]
          )
      )
  
file_path: tensorboard/tensorboard/plugins/custom_scalar/custom_scalar_demo.py
imports: from absl import app
  import tensorflow
  from tensorboard.plugins.custom_scalar import summary
  from tensorboard.plugins.custom_scalar import layout_pb2
label_desc: Use image node_id 3 for calling a global function with example usage: create_layout_summary() and returns: cs_summary