class_docstr: Callback that collects log metrics from the LightningModule and stores them after
  every epoch.
  
  Attributes:
      train_metrics:
          Dictionary that stores the last logged metrics after every train epoch.
      val_metrics:
          Dictionary that stores the last logged metrics after every validation epoch.
  
  Example::
  
      >>> from lightly.utils.benchmarking import MetricCallback
      >>> from pytorch_lightning import LightningModule, Trainer
      >>>
      >>> class Model(LightningModule):
      >>>     def training_step(self, batch, batch_idx):
      >>>         ...
      >>>         self.log("train_acc", acc)
      >>>         ...
      >>>
      >>>     def validation_step(self, batch, batch_idx):
      >>>         ...
      >>>         self.log("val_acc", acc)
      >>>         ...
      >>>
      >>> metric_callback = MetricCallback()
      >>> trainer = Trainer(callbacks=[metric_callback], max_epochs=10)
      >>> trainer.fit(Model(), train_dataloder, val_dataloader)
      >>>
      >>> max_train_acc = max(metric_callback.train_metrics["train_acc"])
      >>> max_val_acc = max(metric_callback.val_metrics["val_acc"])
code: def on_train_epoch_end(
      self, trainer: Trainer, pl_module: LightningModule
  ) -> None:
      if not trainer.sanity_checking:
          self._append_metrics(
              metrics_dict=self.train_metrics, trainer=trainer
          )
  
file_path: lightly/lightly/utils/benchmarking/metric_callback.py
imports: from typing import Dict, List, Union
  from pytorch_lightning import LightningModule, Trainer
  from pytorch_lightning.callbacks import Callback
  from torch import Tensor
label_desc: Use image node_id 2 for calling the MetricCallback obj's underlying member method code with example usage: obj.on_train_epoch_end(trainer, pl_module) without return types