code: def get_ctr_states(
      labels: torch.Tensor,
      predictions: torch.Tensor,
      weights: torch.Tensor,
  ) -> Dict[str, torch.Tensor]:
      return {
          CTR_NUM: torch.sum(labels * weights, dim=-1),
          CTR_DENOM: torch.sum(weights, dim=-1),
      }
  
file_path: torchrec/torchrec/metrics/ctr.py
imports: from typing import Any, cast, Dict, List, Optional, Type
  import torch
  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 2 for calling a global function with example usage: get_ctr_states(labels, predictions, weights) and returns: dict