code: def compute_lambda_ndcg_by_session(
      prediction: torch.Tensor,
      label: torch.Tensor,
      use_exp_gain: bool,
  ) -> torch.Tensor:
      """
      Compute the lambda NDCG loss for one session.
  
      Args:
          prediction(torch.Tensor): a tensor of predicted scores
          label(torch.Tensor): a tensor of labels
          use_exp_gain(bool): whether to use exponential gain or not
  
      Returns:
          loss(torch.Tensor): a tensor of approximate ndcg loss
      """
  
      gain = torch.exp2(label).sub(1.0) if use_exp_gain else label
      discounts = get_position_discounts(prediction)
  
      idcg = gain @ get_position_discounts(label)
      idcg = torch.max(idcg, torch.tensor(1e-6))
      dcg = gain @ discounts
  
      return 1 - dcg / idcg
  
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 3 for calling a global function with example usage: compute_lambda_ndcg_by_session(prediction, label, use_exp_gain) and returns: unknown