Add this lines after transforms

x1 = torch.stack([x1])
x2 = torch.stack([x2])

It’s a simple way to add the batch dimension with 1 sample
It’s the same with unsqueeze(0) , I guess that your error was with the lines 79,80 using a wrong variable