code: def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)
      self.logdir = os.path.join(self.get_temp_dir(), "logdir")
      os.makedirs(self.logdir)
  
      self.logdir_layout = layout_pb2.Layout(
          category=[
              layout_pb2.Category(
                  title="cross entropy",
                  chart=[
                      layout_pb2.Chart(
                          title="cross entropy",
                          multiline=layout_pb2.MultilineChartContent(
                              tag=[r"cross entropy"],
                          ),
                      ),
                  ],
                  closed=True,
              )
          ]
      )
      self.foo_layout = layout_pb2.Layout(
          category=[
              layout_pb2.Category(
                  title="mean biases",
                  chart=[
                      layout_pb2.Chart(
                          title="mean layer biases",
                          multiline=layout_pb2.MultilineChartContent(
                              tag=[
                                  r"mean/layer0/biases",
                                  r"mean/layer1/biases",
                              ],
                          ),
                      ),
                  ],
              ),
              layout_pb2.Category(
                  title="std weights",
                  chart=[
                      layout_pb2.Chart(
                          title="stddev layer weights",
                          multiline=layout_pb2.MultilineChartContent(
                              tag=[r"stddev/layer\d+/weights"],
                          ),
                      ),
                  ],
              ),
              # A category with this name is also present in a layout for a
              # different run (the logdir run) and also contains a duplicate chart
              layout_pb2.Category(
                  title="cross entropy",
                  chart=[
                      layout_pb2.Chart(
                          title="cross entropy margin chart",
                          margin=layout_pb2.MarginChartContent(
                              series=[
                                  layout_pb2.MarginChartContent.Series(
                                      value="cross entropy",
                                      lower="cross entropy lower",
                                      upper="cross entropy upper",
                                  ),
                              ],
                          ),
                      ),
                      layout_pb2.Chart(
                          title="cross entropy",
                          multiline=layout_pb2.MultilineChartContent(
                              tag=[r"cross entropy"],
                          ),
                      ),
                  ],
              ),
          ]
      )
  
      # Generate test data.
      with test_util.FileWriterCache.get(
          os.path.join(self.logdir, "foo")
      ) as writer:
          writer.add_summary(
              test_util.ensure_tb_summary_proto(
                  summary.pb(self.foo_layout)
              )
          )
          for step in range(4):
              writer.add_summary(
                  test_util.ensure_tb_summary_proto(
                      scalar_summary.pb("squares", step * step)
                  ),
                  step,
              )
  
      with test_util.FileWriterCache.get(
          os.path.join(self.logdir, "bar")
      ) as writer:
          for step in range(3):
              writer.add_summary(
                  test_util.ensure_tb_summary_proto(
                      scalar_summary.pb("increments", step + 1)
                  ),
                  step,
              )
  
      # The '.' run lacks scalar data but has a layout.
      with test_util.FileWriterCache.get(self.logdir) as writer:
          writer.add_summary(
              test_util.ensure_tb_summary_proto(
                  summary.pb(self.logdir_layout)
              )
          )
  
      self.plugin = self.createPlugin(self.logdir)
  
imports: import csv
  import io
  import json
  import os
  import numpy
  import tensorflow
  from werkzeug import test
  from werkzeug import wrappers
  from google.protobuf import json_format
  from tensorboard.backend import application
  from tensorboard import context
  from tensorboard.backend.event_processing import data_provider
  from tensorboard.backend.event_processing import plugin_event_multiplexer
  from tensorboard.plugins import base_plugin
  from tensorboard.plugins.custom_scalar import custom_scalars_plugin
  from tensorboard.plugins.custom_scalar import layout_pb2
  from tensorboard.plugins.custom_scalar import summary
  from tensorboard.plugins.scalar import scalars_plugin
  from tensorboard.plugins.scalar import summary
  from tensorboard.util import test_util
label_desc: Use image node_id 1 to create a new CustomScalarsPluginTest object from inherited base classes: tf.test with example: obj = CustomScalarsPluginTest()