class_docstr: This class implements the RecMetricComputation for AUC, i.e. Area Under the Curve.
  
  The constructor arguments are defined in RecMetricComputation.
  See the docstring of RecMetricComputation for more detail.
  Args:
      grouped_auc (bool): If True, computes AUC per group and returns average AUC 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`.
class_docstr_tok: ["This","class","implements","the","RecMetricComputation","for","AUC",",","i.e",".","Area","Under","the","Curve",".","The","constructor","arguments","are","defined","in","RecMetricComputation",".","See","the","docstring","of","RecMetricComputation","for","more","detail",".","Args",":","grouped_auc","(","bool",")",":","If","True",",","computes","AUC","per","group","and","returns","average","AUC","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 AUC metric also
              computes AUC per group and returns the average 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","AUC","metric","also","computes","AUC","per","group","and","returns","the","average","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 AUC metric also
                  computes AUC per group and returns the average AUC across all groups.
      """
      if predictions is None or weights is None:
          raise RecMetricException(
              "Inputs 'predictions' and 'weights' should not be None for AUCMetricComputation 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_auc:
          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 AUCMetricComputation 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
  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 AUCMetricComputation obj's underlying member method code with example usage: obj.update() without return types