def freeze_transforms(self: TDataWTransform) -> TDataWTransform:
        """Returns a new dataset with the transformation groups frozen."""
        tgroups = copy.copy(self._transform_groups)
        frozen_tgroups = copy.copy(self._frozen_transform_groups)
        datacopy = self._shallow_clone_dataset()
        datacopy._frozen_transform_groups = frozen_tgroups + tgroups
        datacopy._transform_groups = EmptyTransformGroups()
        dds: List[IDataset] = []
        for dd in datacopy._datasets:
            if isinstance(dd, _FlatDataWithTransform):
                dds.append(dd.freeze_transforms())
            else:
                dds.append(dd)
        datacopy._datasets = dds
        return datacopy
Returns a new dataset with the transformation groups frozen.
avalanche/benchmarks/utils/data.py