Method
__init__
(
self,
in_channels,
out_channels,
shortcut=True,
expansion=0.5,
depthwise=False,
act="silu",
)
Source from the content-addressed store, hash-verified
| 79 | class Bottleneck(nn.Module): |
| 80 | # Standard bottleneck |
| 81 | def __init__( |
| 82 | self, |
| 83 | in_channels, |
| 84 | out_channels, |
| 85 | shortcut=True, |
| 86 | expansion=0.5, |
| 87 | depthwise=False, |
| 88 | act="silu", |
| 89 | ): |
| 90 | super().__init__() |
| 91 | hidden_channels = int(out_channels * expansion) |
| 92 | Conv = DWConv if depthwise else BaseConv |
| 93 | self.conv1 = BaseConv(in_channels, hidden_channels, 1, stride=1, act=act) |
| 94 | self.conv2 = Conv(hidden_channels, out_channels, 3, stride=1, act=act) |
| 95 | self.use_add = shortcut and in_channels == out_channels |
| 96 | |
| 97 | def forward(self, x): |
| 98 | y = self.conv2(self.conv1(x)) |
Callers
nothing calls this directly
Tested by
no test coverage detected