class_docstr: This set of tests verify the computation logic of weighted avg in several
  corner cases that we know the computation results. The goal is to
  provide some confidence of the correctness of the math formula.
class_docstr_tok: ["This","set","of","tests","verify","the","computation","logic","of","weighted","avg","in","several","corner","cases","that","we","know","the","computation","results",".","The","goal","is","to","provide","some","confidence","of","the","correctness","of","the","math","formula","."]
code: def test_weighted_avg(self) -> None:
      test_data = generate_model_outputs_cases()
      for inputs in test_data:
          try:
              # pyre-ignore
              self._test_weighted_avg_helper(**inputs)
          except AssertionError:
              print("Assertion error caught with data set ", inputs)
              raise
  
file_path: torchrec/torchrec/metrics/tests/test_weighted_avg.py
imports: import unittest
  from typing import Dict, Iterable, Optional, Type, Union
  import torch
  from torchrec.metrics.rec_metric import RecComputeMode, RecMetric, RecTaskInfo
  from torchrec.metrics.test_utils import metric_test_helper, rec_metric_value_test_launcher, TestMetric
  from torchrec.metrics.weighted_avg import get_mean, WeightedAvgMetric
label_desc: Use image node_id 2 for calling the WeightedAvgValueTest obj's underlying member method code with example usage: obj.test_weighted_avg() without return types