def update_key_value(
        self, outputs: torch.Tensor, targets: torch.Tensor
    ) -> Dict[str, torch.Tensor]:
        """Updates segmentation statistics with new data
        and return intermediate metrics values.

        Args:
            outputs: tensor of logits
            targets: tensor of targets

        Returns:
            dict of metric for each class and weighted (if weights were given) metric
        """
        metrics_per_class = self.update(outputs, targets)
        macro_metric = torch.mean(metrics_per_class)
        metrics = {
            f"{self.prefix}{self.metric_name}{self.suffix}/{self.class_names[idx]}": val
            for idx, val in enumerate(metrics_per_class)
        }
        metrics[f"{self.prefix}{self.metric_name}{self.suffix}"] = macro_metric
        if self.weights is not None:
            weighted_metric = 0
            for idx, value in enumerate(metrics_per_class):
                weighted_metric += value * self.weights[idx]
            metrics[
                f"{self.prefix}{self.metric_name}{self.suffix}/_weighted"
            ] = weighted_metric
        return metrics
Updates segmentation statistics with new data
        and return intermediate metrics values.

        Args:
            outputs: tensor of logits
            targets: tensor of targets

        Returns:
            dict of metric for each class and weighted (if weights were given) metric
        
catalyst/metrics/_segmentation.py