biscoff:

but is that alone enough?


Yes, it should be enough to only select the samples with class1 and class7 as seen here:
idx = torch.as_tensor(dataset.targets) == 1
idx += torch.as_tensor(dataset.targets) == 7
dset_train = torch.utils.data.dataset.Subset(dataset, np.where(idx==1)[0])
loader = torch.utils.data.DataLoader(dset_train, batch_size=64)

for data, target in loader:
    print(target)




 biscoff:

but THEN I try applying StandardScaler() or PCA, and it will not work.


How are you trying to apply the StandardScaler?
As described in the docs you would need to fit it first and can then apply it on numpy arrays.
Passing a Dataset will most likely not work.