Hello,
I am looping on dataloader, but I want to access two items and the same time
Example:
dataset1 = ImageFolder(input_folder, transform=transform)
train_loader_a= DataLoader(dataset=dataset1, batch_size=batch_size, shuffle=train, drop_last=True, num_workers=num_workers)

dataset2 = ImageFolder(input_folder, transform=transform)
train_loader_b= DataLoader(dataset=dataset1, batch_size=batch_size, shuffle=train, drop_last=True, num_workers=num_workers)


for it, (images_a, images_b) in enumerate(zip(train_loader_a, train_loader_b)):
        images_a, images_b = Variable(images_a.cuda()), Variable(images_b.cuda())

Here in every iteration, I am loading one tensor from train_loader_a, and one tensor from train_loader_b
what I want to do, that for every iteration, I load two consecutive tensors from each dataloader, while restricting that this is within the same iteration, so for example
train_loader_a has 5 images of names:
a_1
a_2
a_3
a_4
a_5

train_loader_b has 5 images with names:
b_1
b_2
b_3
b_4
b_5

for it = 0, i want to load a_1, a_2 and b_1, b_2
for it = 1, i want to load a_2, a_3 and b_2, b_3
for it = 2, i want to load a_3, a_4 and b_3, b_4
and so on
is there a way to do so ? I tried providing the indices like train_loader_a[it+1] but I received an error TypeError: 'DataLoader' object does not support indexing