Build a special dataset using pytorch tools

let me explain, I have a network to which i have to give as input an image and it has to compute the loss at the end with various images . I am looking for a way to use pytorch dataloaders to do that.
Currently I have several folder with the input image as the first one and the rest being the images used to compute loss.
to resume :
input ->model -> ouput -> loss -> backpropagation, same input but different images for loss etc …
Any idea ?