Skip to content

Commit 4e4b863

Browse files
committed
Missed norm.py
1 parent 7c97e66 commit 4e4b863

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

timm/models/layers/norm.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
""" Normalization layers and wrappers
2+
"""
3+
import torch
4+
import torch.nn as nn
5+
import torch.nn.functional as F
6+
7+
8+
class GroupNorm(nn.GroupNorm):
9+
def __init__(self, num_channels, num_groups, eps=1e-5, affine=True):
10+
# NOTE num_channels is swapped to first arg for consistency in swapping norm layers with BN
11+
super().__init__(num_groups, num_channels, eps=eps, affine=affine)
12+
13+
def forward(self, x):
14+
return F.group_norm(x, self.num_groups, self.weight, self.bias, self.eps)

0 commit comments

Comments
 (0)