(self, x)
| 35 | self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity() |
| 36 | |
| 37 | def forward(self, x): |
| 38 | input = x |
| 39 | x = self.dwconv(x) |
| 40 | x = x.permute(0, 2, 3, 1) # (N, C, H, W) -> (N, H, W, C) |
| 41 | x = self.norm(x) |
| 42 | x = self.pwconv1(x) |
| 43 | x = self.act(x) |
| 44 | x = self.pwconv2(x) |
| 45 | if self.gamma is not None: |
| 46 | x = self.gamma * x |
| 47 | x = x.permute(0, 3, 1, 2) # (N, H, W, C) -> (N, C, H, W) |
| 48 | |
| 49 | x = input + self.drop_path(x) |
| 50 | return x |
| 51 | |
| 52 | class ConvNeXt(nn.Module): |
| 53 | r""" ConvNeXt |
nothing calls this directly
no outgoing calls
no test coverage detected