(self, x: Tensor)
| 228 | return nn.Sequential(*layers) |
| 229 | |
| 230 | def _forward_impl(self, x: Tensor) -> Tensor: |
| 231 | # See note [TorchScript super()] |
| 232 | x = self.conv1(x) |
| 233 | x = self.bn1(x) |
| 234 | x = self.relu(x) |
| 235 | x = self.maxpool(x) |
| 236 | |
| 237 | x = self.layer1(x) |
| 238 | x = self.layer2(x) |
| 239 | x = self.layer3(x) |
| 240 | x_layer4 = self.layer4(x) |
| 241 | |
| 242 | x = self.avgpool(x_layer4) |
| 243 | x = torch.flatten(x, 1) |
| 244 | x = self.fc(x) |
| 245 | |
| 246 | return x, x_layer4 |
| 247 | |
| 248 | def forward(self, x: Tensor) -> Tensor: |
| 249 | return self._forward_impl(x) |