class_docstr: This class implements the RecMetricComputation for NDCG, i.e. Normalized Discounted Cumulative Gain.
  
  The constructor arguments are defined in RecMetricComputation.
  See the docstring of RecMetricComputation for more detail.
class_docstr_tok: ["This","class","implements","the","RecMetricComputation","for","NDCG",",","i.e",".","Normalized","Discounted","Cumulative","Gain",".","The","constructor","arguments","are","defined","in","RecMetricComputation",".","See","the","docstring","of","RecMetricComputation","for","more","detail","."]
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)
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",")"]
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)
      """
      if (
          REQUIRED_INPUTS not in kwargs
          or self._session_key not in kwargs[REQUIRED_INPUTS]
      ):
          raise RecMetricException(
              f"{self._session_key=} {kwargs=} input is required to calculate NDCG"
          )
  
      session_ids = kwargs[REQUIRED_INPUTS][self._session_key]
  
      if predictions is None or weights is None or session_ids is None:
          raise RecMetricException(
              "Inputs 'predictions', 'weights' and 'session_ids' should not be None for NDCGMetricComputation update"
          )
  
      _validate_model_outputs(predictions, labels, weights, session_ids)
  
      predictions = predictions.double()
      labels = labels.double()
      weights = weights.double()
  
      states = get_ndcg_states(
          labels=labels,
          predictions=predictions,
          weights=weights,
          session_ids=session_ids,
          exponential_gain=self._exponential_gain,
      )
      for state_name, state_value in states.items():
          state = getattr(self, state_name).to(labels.device)
          state += state_value
          self._aggregate_window_state(
              state_name, state_value, predictions.shape[-1]
          )
  
imports: from typing import Any, cast, Dict, List, Optional, Type
  import torch
  from torch import 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 2 for calling the NDCGComputation obj's underlying member method code with example usage: obj.update() without return types