The error message indicates that you are trying to torch.stack tensors with a different shape, which is not possible and you would need to make sure all tensors have the same shape.
Your code is not really readable, but it seems the DataLoader throws this error in its collate_fn, which would indicate that your Dataset is returning samples with a different shape.