class_docstr: This class implements the RecMetricComputation for Accuracy.
  
  The constructor arguments are defined in RecMetricComputation.
  See the docstring of RecMetricComputation for more detail.
  
  Args:
      threshold (float): If provided, computes accuracy metrics cutting off at
          the specified threshold.
code: def update(
      self,
      *,
      predictions: Optional[torch.Tensor],
      labels: torch.Tensor,
      weights: Optional[torch.Tensor],
      **kwargs: Dict[str, Any],
  ) -> None:
      if predictions is None:
          raise RecMetricException(
              "Inputs 'predictions' should not be None for AccuracyMetricComputation update"
          )
      states = get_accuracy_states(
          labels, predictions, weights, self._threshold
      )
      num_samples = predictions.shape[-1]
  
      for state_name, state_value in states.items():
          state = getattr(self, state_name)
          state += state_value
          self._aggregate_window_state(
              state_name, state_value, num_samples
          )
  
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 2 for calling the AccuracyMetricComputation obj's underlying member method code with example usage: obj.update() without return types