code: def on_train_begin(self, logs: Dict):
      metrics = ["loss"] + self.model.metrics_names
  
      if self.batch_granularity:
          self.fieldnames = ["epoch", "batch", "size", "time"]
      else:
          self.fieldnames = ["epoch", "time"]
      if getattr(self.model, "optimizer", None) is not None:
          if len(self.model.optimizer.param_groups) > 1:
              self.fieldnames += [
                  f"lr_group_{i}"
                  for i in range(len(self.model.optimizer.param_groups))
              ]
          else:
              self.fieldnames += ["lr"]
      self.fieldnames += metrics
      self.fieldnames += ["val_" + metric for metric in metrics]
      self._on_train_begin_write(logs)
  
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 2 for calling the Logger obj's underlying member method code with example usage: obj.on_train_begin(logs) without return types