Skip to content

Commit

Permalink
Merge pull request WenmuZhou#97 from light1003/patch-3
Browse files Browse the repository at this point in the history
Update CommonModules.py
  • Loading branch information
WenmuZhou authored Sep 11, 2020
2 parents f972058 + 8400280 commit f39b5a6
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions torchocr/networks/CommonModules.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,13 @@ def forward(self, x):
return out


class HardSigmoid(nn.Module):
def __init__(self, slope=.2, offset=.5):
super().__init__()
self.slope = slope
self.offset = offset


class HardSigmoid(nn.Module):
def forward(self, x):
x = (self.slope * x) + self.offset
x = F.threshold(-x, -1, -1)
x = F.threshold(-x, 0, 0)
x = F.relu6(x + 3, inplace=True) / 6
return x



class ConvBNACT(nn.Module):
Expand Down Expand Up @@ -82,4 +78,4 @@ def forward(self, x):
attn = self.relu1(attn)
attn = self.conv2(attn)
attn = self.relu2(attn)
return x * attn
return x * attn

0 comments on commit f39b5a6

Please sign in to comment.