def on_validation_batch_start(
        self,
        trainer: Trainer,
        pl_module: LightningModule,
        batch: Batch,
        batch_idx: int,
    ) -> None:
        """Apply transforms to the batch of tensors during validation."""
        del trainer, pl_module, batch_idx  # Unused
        if self.transform:
            batch.image, batch.gt_mask = self.transform(batch.image, batch.gt_mask)
Apply transforms to the batch of tensors during validation.
src/anomalib/pre_processing/pre_processor.py