MCPcopy Create free account
hub / github.com/RolnickLab/climart / SE_Block

Class SE_Block

climart/models/modules/additional_layers.py:55–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53
54
55class SE_Block(nn.Module):
56 def __init__(self, c, r=16):
57 super().__init__()
58 self.squeeze = GAP()
59 self.excitation = nn.Sequential(
60 nn.Linear(c, c // r, bias=False),
61 nn.ReLU(inplace=True),
62 nn.Linear(c // r, c, bias=False),
63 nn.Sigmoid()
64 )
65
66 def forward(self, x):
67 b, c, f = x.shape
68 y = self.squeeze(x).view(b, c)
69 y = self.excitation(y).view(b, c, 1)
70 return x * y.expand_as(x)
71
72
73class FeatureProjector(nn.Module):

Callers 2

__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected