You are currently using a batch size of 5, which won’t work if you would like to concatenate two images.
If you use an even batch size, you could concatenate the images using this code:
inputs = torch.cat((inputs[::2], inputs[1::2]), 2)

Since you are using shuffle=True, I assume the pairs used to create the larger tensors do not matter. Is this correct or would you like to concatenate specific pairs of image tensors?