def setup(self, trainer: Trainer, pl_module: LightningModule, stage: str) -> None:
        """Move metrics to cpu if ``num_devices == 1`` and ``compute_on_cpu`` is set to ``True``."""
        del pl_module, stage  # Unused arguments.
        if trainer.num_devices > 1:
            if self.compute_on_cpu:
                logger.warning("Number of devices is greater than 1, setting compute_on_cpu to False.")
        elif self.compute_on_cpu:
            self.metrics_to_cpu(self.val_metrics)
            self.metrics_to_cpu(self.test_metrics)
Move metrics to cpu if ``num_devices == 1`` and ``compute_on_cpu`` is set to ``True``.
src/anomalib/metrics/evaluator.py