code: def on_batch(
      self,
      trainer: "GradientDescentTrainer",
      batch_inputs: List[TensorDict],
      batch_outputs: List[Dict[str, Any]],
      batch_metrics: Dict[str, Any],
      epoch: int,
      batch_number: int,
      is_training: bool,
      is_primary: bool = True,
      batch_grad_norm: Optional[float] = None,
      **kwargs,
  ) -> None:
      if not is_primary:
          return None
  
      # We only want to do this for the first batch in the first epoch.
      if batch_number == 1 and epoch == 0 and self._should_log_inputs:
          logger.info("Batch inputs")
          for b, batch in enumerate(batch_inputs):
              self._log_fields(batch, log_prefix="batch_input")
  
file_path: allennlp/allennlp/training/callbacks/console_logger.py
imports: import logging
  from typing import List, Dict, Any, Optional, TYPE_CHECKING
  import torch
  from allennlp.training.callbacks.callback import TrainerCallback
  from allennlp.training.util import get_train_and_validation_metrics
  from allennlp.data import TensorDict
label_desc: Use image node_id 2 for calling the ConsoleLoggerCallback obj's underlying member method code with example usage: obj.on_batch(trainer, batch_inputs, batch_outputs, batch_metrics, epoch, batch_number, is_training, is_primary, batch_grad_norm) and returns: None