code: def compute_auprc(
      n_tasks: int,
      predictions: torch.Tensor,
      labels: torch.Tensor,
      weights: torch.Tensor,
  ) -> torch.Tensor:
      """
      Computes AUPRC (Area Under the Curve) for binary classification.
  
      Args:
          n_tasks (int): number of tasks.
          predictions (torch.Tensor): tensor of size (n_tasks, n_examples).
          labels (torch.Tensor): tensor of size (n_tasks, n_examples).
          weights (torch.Tensor): tensor of size (n_tasks, n_examples).
      """
      auprcs = []
      for predictions_i, labels_i, weights_i in zip(
          predictions, labels, weights
      ):
          auprc = _compute_auprc_helper(
              predictions_i, labels_i, weights_i
          )
          auprcs.append(auprc.view(1))
      return torch.cat(auprcs)
  
imports: from functools import partial
  from typing import Any, cast, Dict, List, Optional, Type
  import torch
  import torch.distributed
  import torch.nn.functional
  from torchrec.metrics.metrics_config import RecComputeMode, RecTaskInfo
  from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
  from torchrec.metrics.rec_metric import MetricComputationReport, RecMetric, RecMetricComputation, RecMetricException
label_desc: Use image node_id 3 for calling a global function with example usage: compute_auprc(n_tasks, predictions, labels, weights) and returns: torch