Since the MNIST data is preloaded completely, you could directly access it via dataset.data and apply the resizing on this tensor directly.
However, if you are working with a dataset, which uses lazy loading, you would have to iterate the dataset, as each sample is loaded in the corresponding iteration.