code: def on_train_batch_end(  # type: ignore
      self,
      trainer: "pl.Trainer",
      pl_module: "pl.LightningModule",
      outputs: Union[torch.Tensor, Mapping[str, torch.Tensor]],
      batch: Any,
      batch_idx: int,
  ) -> None:
      if isinstance(outputs, torch.Tensor):
          loss = outputs.detach()
      elif isinstance(outputs, Mapping):
          loss = outputs["loss"].detach()
      else:
          raise TypeError(
              f"outputs have to be of type torch.Tensor or Mapping, got {type(outputs).__qualname__}"
          )
  
      if self.exclude_batches_path is None:
          self.exclude_batches_path = os.path.join(
              trainer.default_root_dir, "skip_batches.json"
          )
  
      return FabricSpikeDetection.on_train_batch_end(
          self, trainer, loss, batch, batch_idx
      )
  
file_path: pytorch-lightning/src/lightning/pytorch/callbacks/spike.py
imports: import os
  from typing import Any, Mapping, Union
  import torch
  import lightning.pytorch
  from lightning.fabric.utilities.spike import SpikeDetection
  from lightning.pytorch.callbacks.callback import Callback
label_desc: Use image node_id 1 for calling the SpikeDetection obj's underlying member method code with example usage: obj.on_train_batch_end(trainer, pl_module, outputs, batch, batch_idx) and returns: FabricSpikeDetection