Skip to content

Commit

Permalink
main code
Browse files Browse the repository at this point in the history
update default activation function
  • Loading branch information
WongKinYiu authored Jul 11, 2022
1 parent e44853e commit 09b8e34
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def __init__(self, c1, c2, k=1, s=1, p=None, g=1, act=True): # ch_in, ch_out, k
super(Conv, self).__init__()
self.conv = nn.Conv2d(c1, c2, k, s, autopad(k, p), groups=g, bias=False)
self.bn = nn.BatchNorm2d(c2)
self.act = nn.LeakyReLU(0.1, inplace=True) if act is True else (act if isinstance(act, nn.Module) else nn.Identity())
self.act = nn.SiLU() if act is True else (act if isinstance(act, nn.Module) else nn.Identity())

def forward(self, x):
return self.act(self.bn(self.conv(x)))
Expand Down Expand Up @@ -477,7 +477,7 @@ def __init__(self, c1, c2, k=3, s=1, p=None, g=1, act=True, deploy=False):

padding_11 = autopad(k, p) - k // 2

self.act = nn.LeakyReLU(0.1, inplace=True) if act is True else (act if isinstance(act, nn.Module) else nn.Identity())
self.act = nn.SiLU() if act is True else (act if isinstance(act, nn.Module) else nn.Identity())

if deploy:
self.rbr_reparam = nn.Conv2d(c1, c2, k, s, autopad(k, p), groups=g, bias=True)
Expand Down

0 comments on commit 09b8e34

Please sign in to comment.