So you mean if I change shuffle=True I can rewrite my code as
class MyTestDataset():
        def __init__(self, transform_test=None, transform_train=None):
            self.Train = datasets.CIFAR10(root='~/data', train=True,download=False,transform=transform_train)
            self.Test = datasets.CIFAR10(root='~/data', train=False,download=False,transform=transform_test)

        def __getitem__(self, index):    
            x1, y1 = self.Train[index]
            x2, y2 = self.Test[index]
            
            x = torch.stack((x1,x2))
            y = torch.stack((torch.tensor(y1), torch.tensor(y2)))
            
            return x, y, index

        def __len__(self):
            return len(self.Train)+len(self.Test)     
        

dataset = MyTestDataset(transform_test=transform_test, transform_train=transform_train) 
    
loader = torch.utils.data.DataLoader(dataset,batch_size=64,shuffle=True, num_workers=8)

but how can I limit index for the test data in __getitem__? now it gives this error:
in __getitem__
    img, target = self.data[index], self.targets[index]
IndexError: index 31041 is out of bounds for axis 0 with size 10000