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","."]
code: def __init__(
      self,
      *args: Any,
      exponential_gain: bool = False,
      session_key: str = SESSION_KEY,
      **kwargs: Any,
  ) -> None:
      super().__init__(*args, **kwargs)
      self._exponential_gain: bool = exponential_gain
      self._session_key: str = session_key
  
      self._add_state(
          SUM_NDCG,
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
      self._add_state(
          NUM_SESSIONS,
          torch.zeros(self._n_tasks, dtype=torch.double),
          add_window_state=True,
          dist_reduce_fx="sum",
          persistent=True,
      )
  
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 1 to create a new NDCGComputation object from inherited base classes: RecMetricComputation with example: obj = NDCGComputation()