class_docstr: Callback that outputs the result of each epoch_number or batch into a Tensorboard experiment folder.
  
  Args:
      writer (~torch.utils.tensorboard.writer.SummaryWriter): The tensorboard writer.
      split_train_val (bool): Whether to put each training and validation metric in the same graphs.
          (Default = False)
  
  Example:
      Using TensorBoardLogger::
  
          from torch.utils.tensorboard import SummaryWriter
          from poutyne import Model, TensorBoardLogger
  
          writer = SummaryWriter('runs')
          tb_logger = TensorBoardLogger(writer)
  
          model = Model(...)
          model.fit_generator(..., callbacks=[tb_logger])
class_docstr_tok: ["Callback","that","outputs","the","result","of","each","epoch_number","or","batch","into","a","Tensorboard","experiment","folder",".","Args",":","writer","(","~torch.utils.tensorboard.writer.SummaryWriter",")",":","The","tensorboard","writer",".","split_train_val","(","bool",")",":","Whether","to","put","each","training","and","validation","metric","in","the","same","graphs",".","(","Default","=","False",")","Example",":","Using","TensorBoardLogger",":",":","from","torch.utils.tensorboard","import","SummaryWriter","from","poutyne","import","Model",",","TensorBoardLogger","writer","=","SummaryWriter","(","'runs","'",")","tb_logger","=","TensorBoardLogger","(","writer",")","model","=","Model","(","...",")","model.fit_generator","(","...",",","callbacks=","[","tb_logger","]",")"]
code: def _on_epoch_end_write(self, epoch_number: int, logs: dict):
      lr = self._get_current_learning_rates()
  
      if not self.split_train_val:
          grouped_items = {}
          for k, v in logs.items():
              if "val_" in k:
                  primary_key = k[4:]
                  if primary_key not in grouped_items:
                      grouped_items[primary_key] = {}
                  grouped_items[k[4:]][k] = v
              else:
                  if k not in grouped_items:
                      grouped_items[k] = {}
                  grouped_items[k][k] = v
  
          for k, v in grouped_items.items():
              self.writer.add_scalars(k, v, epoch_number)
          self.writer.add_scalars("lr", lr, epoch_number)
      else:
          metrics = {**logs, **lr}
          for metric_name, metric_value in metrics.items():
              self.writer.add_scalar(
                  metric_name, metric_value, epoch_number
              )
  
imports: import csv
  import os
  from typing import Dict, Optional, TextIO
  from poutyne.framework.callbacks._utils import atomic_lambda_save
  from poutyne.framework.callbacks.callbacks import Callback
label_desc: Use image node_id 3 for calling the TensorBoardLogger obj's underlying member method code with example usage: obj._on_epoch_end_write(epoch_number, logs) without return types