code: def _calc_num_true_pos(
      labels: torch.Tensor,
      predictions: torch.Tensor,
      weights: torch.Tensor,
  ) -> torch.Tensor:
      # predictions are expected to be 0 or 1 integers.
      num_true_pos = torch.sum(
          weights * labels * (predictions == 1).double(), dim=-1
      )
      return num_true_pos
  
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 3 for calling a global function with example usage: _calc_num_true_pos(labels, predictions, weights) and returns: num_true_pos