def _get_quantiles_of_maps(self, maps: list[torch.Tensor]) -> tuple[torch.Tensor, torch.Tensor]:
        """Calculate quantiles of anomaly maps.

        Computes the 90% and 99.5% quantiles of the given anomaly maps. If total
        number of elements exceeds 16777216, uses a random subset.

        Args:
            maps (list[torch.Tensor]): List of anomaly maps.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: Tuple containing:
                - 90% quantile scalar
                - 99.5% quantile scalar
        """
        maps_flat = reduce_tensor_elems(torch.cat(maps))
        qa = torch.quantile(maps_flat, q=0.9).to(self.device)
        qb = torch.quantile(maps_flat, q=0.995).to(self.device)
        return qa, qb
Calculate quantiles of anomaly maps.

        Computes the 90% and 99.5% quantiles of the given anomaly maps. If total
        number of elements exceeds 16777216, uses a random subset.

        Args:
            maps (list[torch.Tensor]): List of anomaly maps.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: Tuple containing:
                - 90% quantile scalar
                - 99.5% quantile scalar
        
src/anomalib/models/image/efficient_ad/lightning_model.py