code: def _calc_recall(
      num_true_pos: torch.Tensor, num_false_neg: torch.Tensor
  ) -> torch.Tensor:
      # if num_true_pos + num_false_neg == 0 then we set recall = NaN by default.
      recall = torch.tensor([float("nan")])
      if (num_true_pos + num_false_neg).item() != 0:
          recall = num_true_pos / (num_true_pos + num_false_neg)
      else:
          logger.warning(
              "Recall = NaN. Likely, it means that there were no positive examples passed to the metric yet."
              " Please, debug if you expect every batch to include positive examples."
          )
      return recall
  
imports: import logging
  from typing import Any, cast, Dict, List, Optional, Set, Type, Union
  import torch
  from torch import distributed
  from torchrec.metrics.metrics_config import RecTaskInfo, SessionMetricDef
  from torchrec.metrics.metrics_namespace import MetricName, MetricNamespace, MetricPrefix
  from torchrec.metrics.rec_metric import MetricComputationReport, RecComputeMode, RecMetric, RecMetricComputation, RecMetricException
label_desc: Use image node_id 5 for calling a global function with example usage: _calc_recall(num_true_pos, num_false_neg) and returns: recall