docstr: Parameters
  ----------
  trainer
      Pytorch Lightning trainer.
  pl_module
      Pytorch Lightning module.
  predictions
      The predicted results.
  batch_indices
      The corresponding batch indices for prediction results.
docstr_tok: ["Parameters","--","--","--","--","--","trainer","Pytorch","Lightning","trainer",".","pl_module","Pytorch","Lightning","module",".","predictions","The","predicted","results",".","batch_indices","The","corresponding","batch","indices","for","prediction","results","."]
code: def write_on_epoch_end(
      self,
      trainer: pl.Trainer,
      pl_module: pl.LightningModule,
      predictions: Sequence[Any],
      batch_indices: Sequence[Any],
  ):
      """
      Parameters
      ----------
      trainer
          Pytorch Lightning trainer.
      pl_module
          Pytorch Lightning module.
      predictions
          The predicted results.
      batch_indices
          The corresponding batch indices for prediction results.
      """
      # this will create N (num processes) files in `cache_dir` each containing
      # the predictions of its respective rank
      torch.save(
          predictions,
          self.get_predictions_cache_dir(trainer.global_rank),
      )
      # here we save `batch_indices` to get the information about the data index
      # from prediction data
      torch.save(
          batch_indices,
          self.get_batch_indices_cache_dir(trainer.global_rank),
      )
  
imports: import logging
  import os
  import shutil
  import time
  import uuid
  from pathlib import Path
  from typing import Any, Dict, List, Optional, Sequence
  import lightning.pytorch
  import torch
  from lightning.pytorch.callbacks import BasePredictionWriter
  from ..constants import BBOX, LM_TARGET, LOGIT_SCALE, LOGITS, TEMPLATE_LOGITS, WEIGHT
label_desc: Use image node_id 4 for calling the DDPPredictionWriter obj's underlying member method code with example usage: obj.write_on_epoch_end(trainer, pl_module, predictions, batch_indices) without return types