'ValueError: Expected more than 1 value per channel when training in pytorch 1.8
The input tensor size is [1, 512] and I feed it in a GroupNorm layer.
The layer is self.fc_bn1 = nn.GroupNorm(512 // reduction, 512 // reduction) and the input is x = self.fc_bn1(x)
The error is visible in this image:
That will be worked when I run it in pytorch 1.1, but now I got a machine with pytorch 1.8 and it doesn't work. Since GPUs in this machine cannot use pytorch 1.1, I want to know how to solve this.
I already set model.eval(), so I guess it's not this reason.
Solution 1:[1]
This code does work in pytorch1.1. But I think this is a bug, because the output after GroupNorm is all 0, which is consistent with the mathematical formula. In subsequent versions, this bug has been fixed, so an error is reported.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Wenming Chen |

