def subset(self: TFlatData, indices: Optional[Iterable[int]]) -> TFlatData:
        """Subsampling operation.

        :param indices: indices of the new samples
        :return:
        """
        if indices is not None and not isinstance(indices, list):
            indices = list(indices)

        if self._can_flatten and indices is not None:
            if self._indices is None:
                new_indices = indices
            else:
                self_indices = self._get_lazy_indices()
                new_indices = [self_indices[x] for x in indices]
            return self.__class__(
                datasets=self._datasets,
                indices=new_indices,
                discard_elements_not_in_indices=self._discard_elements_not_in_indices,
            )
        return self.__class__(
            datasets=[self],
            indices=indices,
            discard_elements_not_in_indices=self._discard_elements_not_in_indices,
        )
Subsampling operation.

        :param indices: indices of the new samples
        :return:
        
avalanche/benchmarks/utils/flat_data.py