unbiased=False for torch.var_mean path of ConvNeXt LN. Fix #1090
parent
e0c4eec4b6
commit
738a9cd635
|
@ -94,7 +94,7 @@ class LayerNorm2d(nn.LayerNorm):
|
|||
return F.layer_norm(
|
||||
x.permute(0, 2, 3, 1), self.normalized_shape, self.weight, self.bias, self.eps).permute(0, 3, 1, 2)
|
||||
else:
|
||||
s, u = torch.var_mean(x, dim=1, keepdim=True)
|
||||
s, u = torch.var_mean(x, dim=1, unbiased=False, keepdim=True)
|
||||
x = (x - u) * torch.rsqrt(s + self.eps)
|
||||
x = x * self.weight[:, None, None] + self.bias[:, None, None]
|
||||
return x
|
||||
|
|
Loading…
Reference in New Issue