I am working to denoising autoencoder. I use the ConcatDataset below to concatenate noisy and original images. I am running into a problem where the ConcatDataset(train_dataset_noisy, train_dataset_original) produces a tuple as a list. How can I index the tuple to extract the tensor?
class ConcatDataset(torch.utils.data.Dataset):
def init(self, *datasets):
self.datasets = datasets
def getitem(self, i):
return tuple(d[i] for d in self.datasets)
def len(self):
return min(len(d) for d in self.datasets)
Error:
AttributeError                            Traceback (most recent call last)
 in ()
6
7 for epoch in range(1, max_epoch+1):
----> 8   train(epoch, device=device)
9   test(epoch, device=device)
 in train(epoch, device)
6
7     optimizer.zero_grad()
----> 8     images = images.to(device)
9     output = AE(images)
10     loss = loss_fn(output, images) # Here is a typical loss function (Mean square error)
AttributeError: ‘list’ object has no attribute ‘to’