UserWarning: using a target size (torch.Size([1])) that is different to input size (torch.Size([1],[1]))
giuliasilvestro opened this issue · comments
"This wil likely lead to incorrect results due to broadcasting. Please ensure they have the same size"
Does anybody know how to fix this issue?
I think it's due to pytorch version (I use pytorch 1.1.0) -> just remove the '-1' in the return of the forward function in models.py. It is just a question of shape.
return F.avg_pool2d(x, x.size()[2:]).view(x.size()[0])
Thanks! that worked for the training.
However I get this error whe I execut ./test
File "./test", line 71, in <module>
real_A = Variable(input_A.copy_(batch['A']))
RuntimeError: The expanded size of the tensor (256) must match the existing size (400) at non-singleton dimension 3. Target sizes: [1, 3, 256, 256]. Tensor sizes: [1, 3, 400, 400]
It seems to be just a size issue. Are you testing the model on 400x400 images?
If it is the case you need to run :
./test --size 400
Thanks! that worked.