AssertionError: 3D tensors expect 2 values for padding
shawnricecake opened this issue · 1 comments
shawnricecake commented
Hi,
When I was training the code, it showed the error:
AssertionError: 3D tensors expect 2 values for padding
it was caused by: (in losses.py, line 29)
img = F.pad(img, (kw//2, kh//2, kw//2, kh//2), mode='replicate')
Could u help me with this?
Thanks
shawnricecake commented
I solved this problem by this:
if len(img.shape) < 4:
img = img.unsqueeze(0)
img = F.pad(img, (kw//2, kh//2, kw//2, kh//2), mode='replicate')