def __init__(self, n_classes: int, by_classes: bool=False):
    super().__init__(compute_on_step=False)
    self._n_classes = n_classes
    self._by_classes = by_classes
    self.add_state('image_count_by_classes', default=torch.tensor([0.0 for _ in range(n_classes)]), dist_reduce_fx='sum')
    self.add_state('total_iou_by_classes', default=torch.tensor([0.0 for _ in range(n_classes)]), dist_reduce_fx='sum')
def __init__(self, n_classes: int, by_classes: bool=False):
    super().__init__(compute_on_step=False)
    self._n_classes = n_classes
    self._by_classes = by_classes
    self.add_state('image_count_by_classes', default=torch.tensor([0.0 for _ in range(n_classes)]), dist_reduce_fx='sum')
    self.add_state('total_iou_by_classes', default=torch.tensor([0.0 for _ in range(n_classes)]), dist_reduce_fx='sum')