(self, x)
| 242 | |
| 243 | |
| 244 | def forward(self, x): |
| 245 | |
| 246 | # if input is list, combine batch dimension |
| 247 | is_list = isinstance(x, tuple) or isinstance(x, list) |
| 248 | if is_list: |
| 249 | batch_dim = x[0].shape[0] |
| 250 | x = torch.cat(x, dim=0) |
| 251 | |
| 252 | x = self.conv1(x) |
| 253 | x = self.norm1(x) |
| 254 | x = self.relu1(x) |
| 255 | |
| 256 | x = self.layer1(x) |
| 257 | x = self.layer2(x) |
| 258 | x = self.layer3(x) |
| 259 | x = self.conv2(x) |
| 260 | |
| 261 | if self.training and self.dropout is not None: |
| 262 | x = self.dropout(x) |
| 263 | |
| 264 | if is_list: |
| 265 | x = torch.split(x, [batch_dim, batch_dim], dim=0) |
| 266 | |
| 267 | return x |
nothing calls this directly
no outgoing calls
no test coverage detected