Hi,
Your custom dataset does not have images with same shape. You can add a Resize as a transform in your dataloader so all images can be stacked to each other when dataloader tries to create a batch.



 Khawar_Islam:

testset = datasets.ImageFolder(root="/home/khawar/Desktop/End-to-End_IEEE-TVSCT/test/", transform=transforms.ToTensor())



You can use following transform instead:
tfs = transforms.Compose([
            transforms.Resize(img_size),
            transforms.ToTensor(),
            # normalize,
        ])

Bests