BTW, I suspect it is related to the padding operation, I am working on padding input x first in order to make its width and height even numbers and see if I will succeed.

NO, it’s not   I have made sure that only concatenation is called without padding in the pad_concat function, and directly output h10 without concatenating with x to avoid size mismatching.
Still the bug remains the same. I am wondering whether it is caused by modules before and after, since the final bug says: “RuntimeError: ones needs to be contiguous”. and I did have learnable parameters like this
self.sigma = nn.Parameter(np.log(init_length_scale) * torch.ones(self.in_channels).contiguous(), requires_grad=True)

Honestly, I am not sure what this “ones” means