MCPcopy Create free account
hub / github.com/Zhiyuan-R/Tiger-Diffusion / __init__

Method __init__

modules/se.py:9–16  ·  view source on GitHub ↗
(self, channel, reduction=8, use_relu=False)

Source from the content-addressed store, hash-verified

7 return x * torch.sigmoid(x)
8class SE3d(nn.Module):
9 def __init__(self, channel, reduction=8, use_relu=False):
10 super().__init__()
11 self.fc = nn.Sequential(
12 nn.Linear(channel, channel // reduction, bias=False),
13 nn.ReLU(True) if use_relu else Swish() ,
14 nn.Linear(channel // reduction, channel, bias=False),
15 nn.Sigmoid()
16 )
17
18 def forward(self, inputs):
19 return inputs * self.fc(inputs.mean(-1).mean(-1).mean(-1)).view(inputs.shape[0], inputs.shape[1], 1, 1, 1)

Callers

nothing calls this directly

Calls 1

SwishClass · 0.70

Tested by

no test coverage detected