Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that the discriminator cannot adapt to the size of the input image. #17

Open
SwordHolderSH opened this issue Nov 9, 2019 · 1 comment

Comments

@SwordHolderSH
Copy link

Once I set '-- input_scale_size' not to 64, an error will be reported. It seems that the discriminator cannot adapt to the size of the input image. How did you solve the problem?
"ValueError: Target and input must have the same number of elements. target nelement (2) != input nelement (338)"

@SwordHolderSH
Copy link
Author

I check the shapes of output tensors.
When input size is 64 *64:
torch.Size([2, 64, 32, 32])
torch.Size([2, 64, 32, 32])
torch.Size([2, 128, 16, 16])
torch.Size([2, 128, 16, 16])
torch.Size([2, 128, 16, 16])
torch.Size([2, 256, 8, 8])
torch.Size([2, 256, 8, 8])
torch.Size([2, 256, 8, 8])
torch.Size([2, 512, 4, 4])
torch.Size([2, 512, 4, 4])
torch.Size([2, 512, 4, 4])
torch.Size([2, 1, 1, 1])
torch.Size([2, 1, 1, 1])

When it is 256*256:
torch.Size([2, 64, 128, 128])
torch.Size([2, 64, 128, 128])
torch.Size([2, 128, 64, 64])
torch.Size([2, 128, 64, 64])
torch.Size([2, 128, 64, 64])
torch.Size([2, 256, 32, 32])
torch.Size([2, 256, 32, 32])
torch.Size([2, 256, 32, 32])
torch.Size([2, 512, 16, 16])
torch.Size([2, 512, 16, 16])
torch.Size([2, 512, 16, 16])
torch.Size([2, 1, 13, 13])
torch.Size([2, 1, 13, 13])

So I add two max-pooling layers, to make it roughly work...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant