Custom length of x and y at each iteration of DataLoader

I’m dealing with evaluation step for image-text matching problem. I want to compute the similarity between all images and a number of captions (batch_size). For example, with batch_size=32, at each iteration, DataLoader will return all images and 32 captions.

Is there anyway to do that?!

Hi there,
I think for your usecase you need all images at every training_step, right?
In that case, I would make two different dataloaders, img_loader and text_loader.
Get a batch that consists of all images before training starts and save it in aimg variable.
Then use your text_loader like a normal dataloader, getting a text batch at every step.

Hope this helps!