code: def test_logged_lr(self):
      # Mock LR scheduler
      class SchedulerMock(ClassyParamScheduler):
          def __call__(self, where):
              return where
  
      mock_lr_scheduler = SchedulerMock(UpdateInterval.STEP)
  
      # Mock Logging
      class DummySummaryWriter(object):
          def __init__(self):
              self.scalar_logs = {}
  
          def add_scalar(
              self, key, value, global_step=None, walltime=None
          ) -> None:
              self.scalar_logs[key] = self.scalar_logs.get(key, []) + [
                  value
              ]
  
          def add_histogram(
              self, key, value, global_step=None, walltime=None
          ) -> None:
              return
  
          def add_text(self, *args, **kwargs):
              pass
  
          def flush(self):
              return
  
      config = get_test_mlp_task_config()
      config["num_epochs"] = 3
      config["dataset"]["train"]["batchsize_per_replica"] = 10
      config["dataset"]["test"]["batchsize_per_replica"] = 5
      task = build_task(config)
  
      writer = DummySummaryWriter()
      hook = TensorboardPlotHook(writer)
      hook.log_period = 1
      task.set_hooks([hook])
      task.set_optimizer_schedulers({"lr": mock_lr_scheduler})
  
      trainer = LocalTrainer()
      trainer.train(task)
  
      # We have 20 samples, batch size is 10. Each epoch is done in two steps.
      self.assertEqual(
          writer.scalar_logs["Learning Rate/train"],
          [0, 1 / 6, 2 / 6, 3 / 6, 4 / 6, 5 / 6],
      )
  
file_path: ClassyVision/test/manual/hooks_tensorboard_plot_hook_test.py
imports: import copy
  import shutil
  import tempfile
  import unittest.mock
  from itertools import product
  from classy_vision.hooks import TensorboardPlotHook
  from classy_vision.optim.param_scheduler import ClassyParamScheduler, UpdateInterval
  from classy_vision.tasks import build_task
  from classy_vision.tasks.classification_task import LastBatchInfo
  from classy_vision.trainer import LocalTrainer
  from test.generic.config_utils import get_test_mlp_task_config, get_test_task_config
  from test.generic.hook_test_utils import HookTestBase
  from torch.utils.tensorboard import SummaryWriter
label_desc: Use image node_id 5 for calling the TestTensorboardPlotHook obj's underlying member method code with example usage: obj.test_logged_lr() and returns: where