It looks like in the documentation for SubsetRandomSampler the constructor expects indices that can be sampled from rather than the actual dataset itself:
https://pytorch.org/docs/stable/_modules/torch/utils/data/sampler.html#SubsetRandomSampler 9