docstr: Test single session in a update
docstr_tok: ["Test","single","session","in","a","update"]
code: def test_single_session(self) -> None:
      """
      Test single session in a update
      """
      model_output = generate_model_output_multiple_sessions()
      self.non_exponential_ndcg.update(
          predictions={
              DefaultTaskInfo.name: model_output["predictions"][0]
          },
          labels={DefaultTaskInfo.name: model_output["labels"][0]},
          weights={DefaultTaskInfo.name: model_output["weights"][0]},
          required_inputs={SESSION_KEY: model_output["session_ids"][0]},
      )
      metric = self.non_exponential_ndcg.compute()
      actual_metric = metric[
          f"ndcg-{DefaultTaskInfo.name}|lifetime_ndcg"
      ]
      expected_metric = model_output["expected_ndcg_non_exp"]
  
      torch.testing.assert_close(
          actual_metric,
          expected_metric,
          atol=1e-4,
          rtol=1e-4,
          check_dtype=False,
          equal_nan=True,
          msg=f"Actual: {actual_metric}, Expected: {expected_metric}",
      )
  
      self.exponential_ndcg.update(
          predictions={
              DefaultTaskInfo.name: model_output["predictions"][0]
          },
          labels={DefaultTaskInfo.name: model_output["labels"][0]},
          weights={DefaultTaskInfo.name: model_output["weights"][0]},
          required_inputs={SESSION_KEY: model_output["session_ids"][0]},
      )
      metric = self.exponential_ndcg.compute()
      actual_metric = metric[
          f"ndcg-{DefaultTaskInfo.name}|lifetime_ndcg"
      ]
      expected_metric = model_output["expected_ndcg_exp"]
  
      torch.testing.assert_close(
          actual_metric,
          expected_metric,
          atol=1e-4,
          rtol=1e-4,
          check_dtype=False,
          equal_nan=True,
          msg=f"Actual: {actual_metric}, Expected: {expected_metric}",
      )
  
file_path: torchrec/torchrec/metrics/tests/test_ndcg.py
imports: import unittest
  from typing import Dict
  import torch
  from torchrec.metrics.metrics_config import DefaultTaskInfo
  from torchrec.metrics.ndcg import NDCGMetric, SESSION_KEY
label_desc: Use image node_id 2 for calling the NDCGMetricValueTest obj's underlying member method code with example usage: obj.test_single_session() without return types