def forward(
        self,
        patch_scores: torch.Tensor,
        image_size: tuple[int, int] | torch.Size | None = None,
    ) -> torch.Tensor:
        """Generate smoothed anomaly map from patch scores.

        Args:
            patch_scores (torch.Tensor): Patch-level anomaly scores with shape
                ``(B, 1, H, W)``
            image_size (tuple[int, int] | torch.Size | None, optional): Target
                size ``(H, W)`` to upsample anomaly map. If ``None``, keeps
                original size. Defaults to ``None``.

        Example:
            >>> generator = AnomalyMapGenerator(sigma=4)
            >>> patch_scores = torch.randn(32, 1, 28, 28)
            >>> anomaly_map = generator(
            ...     patch_scores=patch_scores,
            ...     image_size=(224, 224)
            ... )

        Returns:
            torch.Tensor: Anomaly heatmap after upsampling and smoothing,
                with shape ``(B, 1, H, W)``
        """
        return self.compute_anomaly_map(patch_scores, image_size)
Generate smoothed anomaly map from patch scores.

        Args:
            patch_scores (torch.Tensor): Patch-level anomaly scores with shape
                ``(B, 1, H, W)``
            image_size (tuple[int, int] | torch.Size | None, optional): Target
                size ``(H, W)`` to upsample anomaly map. If ``None``, keeps
                original size. Defaults to ``None``.

        Example:
            >>> generator = AnomalyMapGenerator(sigma=4)
            >>> patch_scores = torch.randn(32, 1, 28, 28)
            >>> anomaly_map = generator(
            ...     patch_scores=patch_scores,
            ...     image_size=(224, 224)
            ... )

        Returns:
            torch.Tensor: Anomaly heatmap after upsampling and smoothing,
                with shape ``(B, 1, H, W)``
        
src/anomalib/models/image/patchcore/anomaly_map.py