MCPcopy Create free account
hub / github.com/geekcomputers/Python / forward

Method forward

ML/src/python/neuralforge/nn/modules.py:172–177  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

170 self.conv = nn.Conv2d(2, 1, kernel_size, padding=kernel_size // 2)
171
172 def forward(self, x):
173 avg_out = torch.mean(x, dim=1, keepdim=True)
174 max_out, _ = torch.max(x, dim=1, keepdim=True)
175 attention = torch.cat([avg_out, max_out], dim=1)
176 attention = torch.sigmoid(self.conv(attention))
177 return x * attention
178
179class CBAM(nn.Module):
180 def __init__(self, channels, reduction=16, kernel_size=7):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected