class_docstr: Performs model confidence checks.
  
  Checks performed:
  
  * `NormalizationBiasVerification` for detecting invalid combinations of
     bias and normalization layers.
     See `allennlp.confidence_checks.normalization_bias_verification` for more details.
  
  Note: Any new confidence checks should also be added to this callback.
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 destroy the hooks after the first batch, since we only want to
      # perform this check once.
      if epoch == 0 and batch_number == 1 and is_training:
          self._verification.destroy_hooks()
          detected_pairs = self._verification.collect_detections()
          if len(detected_pairs) > 0:
              raise ConfidenceCheckError(
                  "The NormalizationBiasVerification check failed. See logs for more details."
              )
  
file_path: allennlp/allennlp/training/callbacks/confidence_checks.py
imports: from typing import List, Dict, Any, Optional, TYPE_CHECKING
  from allennlp.training.callbacks.callback import TrainerCallback
  from allennlp.data import TensorDict
  from allennlp.confidence_checks.normalization_bias_verification import NormalizationBiasVerification
label_desc: Use image node_id 2 for calling the ConfidenceChecksCallback 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