code: def get_accuracy_states(
      labels: torch.Tensor,
      predictions: torch.Tensor,
      weights: Optional[torch.Tensor],
      threshold: float = 0.5,
  ) -> Dict[str, torch.Tensor]:
      if weights is None:
          weights = torch.ones_like(predictions)
      return {
          "accuracy_sum": compute_accuracy_sum(
              labels, predictions, weights, threshold
          ),
          "weighted_num_samples": torch.sum(weights, dim=-1),
      }
  
file_path: torchrec/torchrec/metrics/accuracy.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 3 for calling a global function with example usage: get_accuracy_states(labels, predictions, weights, threshold) and returns: dict