From fcaf9b8d233fa784135670c8a30425329dc9728f Mon Sep 17 00:00:00 2001 From: Fredo Guan Date: Sat, 7 Jan 2023 23:34:02 -0800 Subject: [PATCH] Update metaformers.py --- timm/models/metaformers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/timm/models/metaformers.py b/timm/models/metaformers.py index bedc8738..8857cd41 100644 --- a/timm/models/metaformers.py +++ b/timm/models/metaformers.py @@ -356,8 +356,8 @@ class LayerNormGeneral(nn.Module): self.normalized_dim = normalized_dim self.use_scale = scale self.use_bias = bias - self.weight = nn.Parameter(torch.ones(affine_shape)) if scale else torch.ones(affine_shape) - self.bias = nn.Parameter(torch.zeros(affine_shape)) if bias else torch.zeros(affine_shape) + self.weight = nn.Parameter(torch.ones(affine_shape)) if scale else 1 + self.bias = nn.Parameter(torch.zeros(affine_shape)) if bias else 0 self.eps = eps def forward(self, x):