def get_num_masks(self, class_labels: torch.Tensor, device: torch.device) -> torch.Tensor:
        """
        Computes the average number of target masks across the batch, for normalization purposes.
        """
        num_masks = sum([len(classes) for classes in class_labels])
        num_masks_pt = torch.as_tensor([num_masks], dtype=torch.float, device=device)
        return num_masks_pt

        Computes the average number of target masks across the batch, for normalization purposes.
        
dpkd/transformers/src/transformers/models/oneformer/modeling_oneformer.py