code: def _compute(states: Dict[str, torch.Tensor]) -> torch.Tensor:
      if "num_samples" not in states or "time_lapse" not in states:
          # This is to match the default 0.0 output from TowerQPSMetric if warmup is not done
          return torch.tensor(float("0.0"), dtype=torch.double)
  
      return torch.where(
          states["time_lapse"] <= 0.0,
          0.0,
          states["num_samples"] / states["time_lapse"],
      ).double()
  
imports: import unittest
  from functools import partial, update_wrapper
  from typing import Callable, Dict, List, Optional, Tuple, Type
  import torch
  import torch.distributed
  from torchrec.metrics.metrics_config import DefaultTaskInfo
  from torchrec.metrics.model_utils import parse_task_model_outputs
  from torchrec.metrics.rec_metric import RecComputeMode, RecMetric, RecTaskInfo
  from torchrec.metrics.test_utils import gen_test_batch, gen_test_tasks, metric_test_helper, rec_metric_value_test_launcher, TestMetric
  from torchrec.metrics.tower_qps import TowerQPSMetric
label_desc: Use image node_id 4 for calling the TestTowerQPSMetric obj's underlying member method code with example usage: obj._compute(states) and returns: torch, torch