def up_sample(distance: torch.Tensor, image_size: tuple[int, int] | torch.Size) -> torch.Tensor:
        """Up sample anomaly score to match the input image size.

        Args:
            distance (torch.Tensor): Anomaly scores, shape
                ``(batch_size, 1, height, width)``
            image_size (tuple[int, int] | torch.Size): Target size for upsampling,
                usually the original input image size

        Returns:
            torch.Tensor: Upsampled anomaly scores matching the input image size
        """
        return F.interpolate(
            distance,
            size=image_size,
            mode="bilinear",
            align_corners=False,
        )
Up sample anomaly score to match the input image size.

        Args:
            distance (torch.Tensor): Anomaly scores, shape
                ``(batch_size, 1, height, width)``
            image_size (tuple[int, int] | torch.Size): Target size for upsampling,
                usually the original input image size

        Returns:
            torch.Tensor: Upsampled anomaly scores matching the input image size
        
src/anomalib/models/image/padim/anomaly_map.py