def _check_input_labels(self, labels: List[int]) -> None:
        """
        Check if the labels list is valid: contains k occurrences
        for each of p classes.

        Args:
            labels: labels in the batch

        Raises:
            ValueError: if batch is invalid (contains different samples
                for classes, contains only one class or only one sample for
                each class)
        """
        labels_counter = Counter(labels)
        k = labels_counter[labels[0]]
        if not all(n == k for n in labels_counter.values()):
            raise ValueError("Expected equal number of samples for each class")
        if len(labels_counter) <= 1:
            raise ValueError("Expected at least 2 classes in the batch")
        if k == 1:
            raise ValueError("Expected more than one sample for each class")

        Check if the labels list is valid: contains k occurrences
        for each of p classes.

        Args:
            labels: labels in the batch

        Raises:
            ValueError: if batch is invalid (contains different samples
                for classes, contains only one class or only one sample for
                each class)
        
catalyst/contrib/data/sampler_inbatch.py