def __init__(self, shuffle=True, min_num_samples=1, max_num_samples=None,
                 weights=None, train_weights=None, test_weights=None,
                 support_weights=None, query_weights=None,
                 force_equal_per_class=False, random_state_seed=0):
        """
        Transforms a dataset into train/test splits for few-shot learning tasks.
        The number of samples per class is proportional to the number of samples
        per class in the original dataset. This is a dataset transformation to
        be applied as a `dataset_transform` in a `MetaDataset`.

        Parameters
        ----------
        shuffle : bool (default: `True`)
            Shuffle the data in the dataset before the split.

        min_num_samples : int or dict, optional (default: 1)
            Minimum number of samples per class.

        max_num_samples : int or dict, optional
            Maximum number of samples per class.

        weights : dict, optional
            Dictionary containing the names of the splits (as keys) and the
            corresponding proportions of samples per class in each split (as
            values). If not `None`, then the arguments `train_weights`,
            `test_weights`, `support_weights` and `query_weights` are ignored.

        train_weights : float, optional
            Proportion of samples from each class in the training split. If not
            `None`, this creates an item `train` for each task.

        test_weights : float, optional
            Proportion of samples from each class in the training split. If not
            `None`, this creates an item `test` for each task.

        support_weights : float, optional
            Alias for `train_weights`. If `train_weights` is not `None`, then
            this argument is ignored. If not `None`, this creates an item
            `support` for each task.

        query_weights : float, optional
            Alias for `test_weights`. If `test_weights` is not `None`, then this
            argument is ignored. If not `None`, this creates an item `query` for
            each task.

        force_equal_per_class : bool (default: `False`)
            If `True`, then the number of samples per class is equal for each
            class; this is then proportional to the number of samples in the
            class with the minimum number of samples.

        random_state_seed : int, optional
            seed of the np.RandomState. Defaults to '0'.
        """
        self.shuffle = shuffle
        self.force_equal_per_class = force_equal_per_class

        if weights is None:
            weights = OrderedDict()
            if train_weights is not None:
                weights['train'] = train_weights
            elif support_weights is not None:
                weights['support'] = support_weights
            if test_weights is not None:
                weights['test'] = test_weights
            elif query_weights is not None:
                weights['query'] = query_weights
        assert len(weights) > 0
        assert sum(weights.values()) <= 1.

        if (min_num_samples is None) or isinstance(min_num_samples, int):
            if min_num_samples is None:
                min_num_samples = 0
            self.min_num_samples = OrderedDict([(split, min_num_samples)
                for split in weights])
        elif isinstance(min_num_samples, dict):
            self.min_num_samples = OrderedDict(min_num_samples)
        else:
            raise NotImplementedError('Argument `min_num_samples` in '
                '`WeightedClassSplitter` must be of type `dict` or `int`. Got '
                'type `{0}`.'.format(type(min_num_samples)))

        if max_num_samples is None:
            self.max_num_samples = None
        elif isinstance(max_num_samples, int):
            self.max_num_samples = OrderedDict([(split, max_num_samples)
                for split in weights])
        elif isinstance(max_num_samples, dict):
            self.max_num_samples = OrderedDict(max_num_samples)
        else:
            raise NotImplementedError('Argument `max_num_samples` in '
                '`WeightedClassSplitter` must be of type `dict` or `int`. Got '
                'type `{0}`.'.format(type(min_num_samples)))

        self._min_samples_per_class = sum(self.min_num_samples.values())
        super(WeightedClassSplitter_, self).__init__(weights, random_state_seed)

        Transforms a dataset into train/test splits for few-shot learning tasks.
        The number of samples per class is proportional to the number of samples
        per class in the original dataset. This is a dataset transformation to
        be applied as a `dataset_transform` in a `MetaDataset`.

        Parameters
        ----------
        shuffle : bool (default: `True`)
            Shuffle the data in the dataset before the split.

        min_num_samples : int or dict, optional (default: 1)
            Minimum number of samples per class.

        max_num_samples : int or dict, optional
            Maximum number of samples per class.

        weights : dict, optional
            Dictionary containing the names of the splits (as keys) and the
            corresponding proportions of samples per class in each split (as
            values). If not `None`, then the arguments `train_weights`,
            `test_weights`, `support_weights` and `query_weights` are ignored.

        train_weights : float, optional
            Proportion of samples from each class in the training split. If not
            `None`, this creates an item `train` for each task.

        test_weights : float, optional
            Proportion of samples from each class in the training split. If not
            `None`, this creates an item `test` for each task.

        support_weights : float, optional
            Alias for `train_weights`. If `train_weights` is not `None`, then
            this argument is ignored. If not `None`, this creates an item
            `support` for each task.

        query_weights : float, optional
            Alias for `test_weights`. If `test_weights` is not `None`, then this
            argument is ignored. If not `None`, this creates an item `query` for
            each task.

        force_equal_per_class : bool (default: `False`)
            If `True`, then the number of samples per class is equal for each
            class; this is then proportional to the number of samples in the
            class with the minimum number of samples.

        random_state_seed : int, optional
            seed of the np.RandomState. Defaults to '0'.
        
torchmeta/transforms/splitters.py