()
| 36 | |
| 37 | |
| 38 | def test_collections(): |
| 39 | max_metric = Max() |
| 40 | count_metric = Count() |
| 41 | metric = MetricCollection([max_metric, count_metric]) |
| 42 | |
| 43 | examples = [{"value": idx} for idx in range(123)] |
| 44 | for outputs in examples: |
| 45 | metric.update(outputs) |
| 46 | |
| 47 | assert metric.compute() == { |
| 48 | max_metric.__class__.__name__: len(examples) - 1, |
| 49 | count_metric.__class__.__name__: len(examples), |
| 50 | } |
| 51 | |
| 52 | |
| 53 | def test_task_dependent_ctr(): |