class_docstr: This class implements the RecMetricComputation for AUPRC, i.e. Area Under the Curve.
  
  The constructor arguments are defined in RecMetricComputation.
  See the docstring of RecMetricComputation for more detail.
  Args:
      grouped_auprc (bool): If True, computes AUPRC per group and returns average AUPRC across all groups.
          The `grouping_keys` is provided during state updates along with predictions, labels, weights.
          This feature is currently not enabled for `fused_update_limit`.
docstr: Args:
      predictions (torch.Tensor): tensor of size (n_task, n_examples)
      labels (torch.Tensor): tensor of size (n_task, n_examples)
      weights (torch.Tensor): tensor of size (n_task, n_examples)
      grouping_key (torch.Tensor): Optional tensor of size (1, n_examples) that specifies the groups of
              predictions/labels per batch. If provided, the PR AUC metric also
              computes PR AUC per group and returns the average PR AUC across all groups.
docstr_tok: ["Args",":","predictions","(","torch.Tensor",")",":","tensor","of","size","(","n_task",",","n_examples",")","labels","(","torch.Tensor",")",":","tensor","of","size","(","n_task",",","n_examples",")","weights","(","torch.Tensor",")",":","tensor","of","size","(","n_task",",","n_examples",")","grouping_key","(","torch.Tensor",")",":","Optional","tensor","of","size","(","1",",","n_examples",")","that","specifies","the","groups","of","predictions\/labels","per","batch",".","If","provided",",","the","PR","AUC","metric","also","computes","PR","AUC","per","group","and","returns","the","average","PR","AUC","across","all","groups","."]
code: def update(
      self,
      *,
      predictions: Optional[torch.Tensor],
      labels: torch.Tensor,
      weights: Optional[torch.Tensor],
      **kwargs: Dict[str, Any],
  ) -> None:
      """
      Args:
          predictions (torch.Tensor): tensor of size (n_task, n_examples)
          labels (torch.Tensor): tensor of size (n_task, n_examples)
          weights (torch.Tensor): tensor of size (n_task, n_examples)
          grouping_key (torch.Tensor): Optional tensor of size (1, n_examples) that specifies the groups of
                  predictions/labels per batch. If provided, the PR AUC metric also
                  computes PR AUC per group and returns the average PR AUC across all groups.
      """
      if predictions is None or weights is None:
          raise RecMetricException(
              "Inputs 'predictions' and 'weights' should not be None for AUPRCMetricComputation update"
          )
      predictions = predictions.float()
      labels = labels.float()
      weights = weights.float()
      num_samples = getattr(self, PREDICTIONS)[0].size(-1)
      batch_size = predictions.size(-1)
      start_index = max(num_samples + batch_size - self._window_size, 0)
      # Using `self.predictions =` will cause Pyre errors.
      getattr(self, PREDICTIONS)[0] = torch.cat(
          [
              cast(torch.Tensor, getattr(self, PREDICTIONS)[0])[
                  :, start_index:
              ],
              predictions,
          ],
          dim=-1,
      )
      getattr(self, LABELS)[0] = torch.cat(
          [
              cast(torch.Tensor, getattr(self, LABELS)[0])[
                  :, start_index:
              ],
              labels,
          ],
          dim=-1,
      )
      getattr(self, WEIGHTS)[0] = torch.cat(
          [
              cast(torch.Tensor, getattr(self, WEIGHTS)[0])[
                  :, start_index:
              ],
              weights,
          ],
          dim=-1,
      )
      if self._grouped_auprc:
          if REQUIRED_INPUTS not in kwargs or (
              (
                  grouping_keys := kwargs[REQUIRED_INPUTS].get(
                      GROUPING_KEYS
                  )
              )
              is None
          ):
              raise RecMetricException(
                  f"Input '{GROUPING_KEYS}' are required for AUPRCMetricComputation grouped update"
              )
          getattr(self, GROUPING_KEYS)[0] = torch.cat(
              [
                  cast(torch.Tensor, getattr(self, GROUPING_KEYS)[0])[
                      start_index:
                  ],
                  grouping_keys.squeeze(),
              ],
              dim=0,
          )
  
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 the AUPRCMetricComputation obj's underlying member method code with example usage: obj.update() without return types