def _compute_zero_shot_scores(
        self,
        image_scores: torch.Tensor,
        window_embeddings: list[torch.Tensor],
    ) -> torch.Tensor:
        """Compute multi-scale anomaly score maps using text embeddings.

        Each window embedding is compared to text embeddings for similarity scores.
        Harmonic averaging aggregates window scores into score maps per scale.
        Score maps are combined into single multi-scale map by cross-scale
        aggregation.

        Args:
            image_scores (torch.Tensor): Full image scores of shape ``(batch_size)``.
            window_embeddings (list[torch.Tensor]): Window embeddings list, each of
                shape ``(batch_size, n_windows, n_features)``.

        Returns:
            torch.Tensor: Zero-shot scores of shape ``(batch_size, H, W)``.
        """
        # image scores are added to represent the full image scale
        multi_scale_scores = [image_scores.view(-1, 1, 1).repeat(1, self.grid_size[0], self.grid_size[1])]
        # add aggregated scores for each scale
        for window_embedding, mask in zip(window_embeddings, self.masks, strict=True):
            scores = class_scores(window_embedding, self.text_embeddings, self.temperature, target_class=1)
            multi_scale_scores.append(harmonic_aggregation(scores, self.grid_size, mask))
        # aggregate scores across scales
        return (len(self.scales) + 1) / (1 / torch.stack(multi_scale_scores)).sum(dim=0)
Compute multi-scale anomaly score maps using text embeddings.

        Each window embedding is compared to text embeddings for similarity scores.
        Harmonic averaging aggregates window scores into score maps per scale.
        Score maps are combined into single multi-scale map by cross-scale
        aggregation.

        Args:
            image_scores (torch.Tensor): Full image scores of shape ``(batch_size)``.
            window_embeddings (list[torch.Tensor]): Window embeddings list, each of
                shape ``(batch_size, n_windows, n_features)``.

        Returns:
            torch.Tensor: Zero-shot scores of shape ``(batch_size, H, W)``.
        
src/anomalib/models/image/winclip/torch_model.py