Closed PgLoLo closed 5 years ago
As far, as I understand, the miniBatchStdDev layer has a bug in this line
There the group and batch dimensions swap so after that std outputs tiled incorrectly.
We can try this on this code sample:
a = torch.tensor([0, 0, 0, 0, 1, 2, 3, 4, 100, 200, 300, 400], dtype=torch.float32) a = a.reshape(-1, 1, 1, 1) miniBatchStdDev(a, 4)[:, -1, 0, 0]
The output would be
tensor([ 99.5100, 99.5100, 99.5100, 99.5100, 149.1763, 149.1763, 149.1763, 149.1763, 188.8589, 188.8589, 188.8589, 188.8589])
wich is obviously incorrect and should be
tensor([99.5100, 149.1763, 188.8589, 99.5100, 149.1763, 188.8589, 99.5100, 149.1763, 188.8589, 99.5100, 149.1763, 188.8589])
Am I right?
Indeed it seems that you're right. I'll correct it right away.
I'll need to test it but there should be a PR within a week.
Thanks for pointing the bug, it was well hidden.
https://github.com/facebookresearch/pytorch_GAN_zoo/pull/70
As far, as I understand, the miniBatchStdDev layer has a bug in this line
There the group and batch dimensions swap so after that std outputs tiled incorrectly.
We can try this on this code sample:
The output would be
wich is obviously incorrect and should be
Am I right?