Solved by swap in post #2 
              
              
                from torch.utils.data import TensorDataset, DataLoader 
BATCH_SIZE = 512 
tensor_x = torch.Tensor(images[train_indices]) 
tensor_y = torch.Tensor(labels[train_indices]) 
dataset_train = TensorDataset(tensor_x, tensor_y) 
train_loader = DataLoader(dataset_train, batch_size=BATCH_SIZE) 
you can iterat…