def forward(self, **kwargs: list[torch.Tensor] | list[int] | list[list]) -> torch.Tensor:
        """Generate anomaly map from input feature distributions.

        The method expects keyword arguments containing the feature distributions
        and corresponding spatial dimensions.

        Args:
            **kwargs: Keyword arguments containing:
                - distribution (list[torch.Tensor]): Feature distributions
                - height (list[int]): Feature map heights
                - width (list[int]): Feature map widths
                - image_size (tuple[int, int] | torch.Size | None, optional):
                    Target output size

        Example:
            >>> generator = AnomalyMapGenerator(pool_layers=["layer1", "layer2"])
            >>> distribution = [torch.randn(32, 64) for _ in range(2)]
            >>> height = [32, 16]
            >>> width = [32, 16]
            >>> anomaly_map = generator(
            ...     distribution=distribution,
            ...     height=height,
            ...     width=width
            ... )

        Raises:
            KeyError: If required arguments `distribution`, `height` or `width`
                are missing.

        Returns:
            torch.Tensor: Generated anomaly map.
        """
        if not ("distribution" in kwargs and "height" in kwargs and "width" in kwargs):
            msg = f"Expected keys `distribution`, `height` and `width`. Found {kwargs.keys()}"
            raise KeyError(msg)

        # placate mypy
        distribution: list[torch.Tensor] = cast(list[torch.Tensor], kwargs["distribution"])
        height: list[int] = cast(list[int], kwargs["height"])
        width: list[int] = cast(list[int], kwargs["width"])
        image_size: tuple[int, int] | torch.Size | None = kwargs.get("image_size", None)
        return self.compute_anomaly_map(distribution, height, width, image_size)
Generate anomaly map from input feature distributions.

        The method expects keyword arguments containing the feature distributions
        and corresponding spatial dimensions.

        Args:
            **kwargs: Keyword arguments containing:
                - distribution (list[torch.Tensor]): Feature distributions
                - height (list[int]): Feature map heights
                - width (list[int]): Feature map widths
                - image_size (tuple[int, int] | torch.Size | None, optional):
                    Target output size

        Example:
            >>> generator = AnomalyMapGenerator(pool_layers=["layer1", "layer2"])
            >>> distribution = [torch.randn(32, 64) for _ in range(2)]
            >>> height = [32, 16]
            >>> width = [32, 16]
            >>> anomaly_map = generator(
            ...     distribution=distribution,
            ...     height=height,
            ...     width=width
            ... )

        Raises:
            KeyError: If required arguments `distribution`, `height` or `width`
                are missing.

        Returns:
            torch.Tensor: Generated anomaly map.
        
src/anomalib/models/image/cflow/anomaly_map.py