def forward(self, hidden_variables: list[torch.Tensor]) -> torch.Tensor:
        """Generate anomaly heatmap from hidden variables.

        This implementation generates the heatmap based on the flow maps computed
        from the normalizing flow (NF) FastFlow blocks. Each block yields a flow
        map, which overall is stacked and averaged to produce an anomaly map.

        The process for each hidden variable is:
            1. Compute negative log probability as mean of squared values
            2. Convert to probability via exponential
            3. Interpolate to input size
            4. Stack all flow maps and average to get final anomaly map

        Args:
            hidden_variables (list[torch.Tensor]): List of hidden variables from
                each NF FastFlow block. Each tensor has shape
                ``(N, C, H, W)``.

        Returns:
            torch.Tensor: Anomaly heatmap with shape ``(N, 1, H, W)`` where
                ``H, W`` match the ``input_size``.
        """
        flow_maps: list[torch.Tensor] = []
        for hidden_variable in hidden_variables:
            log_prob = -torch.mean(hidden_variable**2, dim=1, keepdim=True) * 0.5
            prob = torch.exp(log_prob)
            flow_map = F.interpolate(
                input=-prob,
                size=self.input_size,
                mode="bilinear",
                align_corners=False,
            )
            flow_maps.append(flow_map)
        flow_maps = torch.stack(flow_maps, dim=-1)
        return torch.mean(flow_maps, dim=-1)
Generate anomaly heatmap from hidden variables.

        This implementation generates the heatmap based on the flow maps computed
        from the normalizing flow (NF) FastFlow blocks. Each block yields a flow
        map, which overall is stacked and averaged to produce an anomaly map.

        The process for each hidden variable is:
            1. Compute negative log probability as mean of squared values
            2. Convert to probability via exponential
            3. Interpolate to input size
            4. Stack all flow maps and average to get final anomaly map

        Args:
            hidden_variables (list[torch.Tensor]): List of hidden variables from
                each NF FastFlow block. Each tensor has shape
                ``(N, C, H, W)``.

        Returns:
            torch.Tensor: Anomaly heatmap with shape ``(N, 1, H, W)`` where
                ``H, W`` match the ``input_size``.
        
src/anomalib/models/image/fastflow/anomaly_map.py