| 286 | return x, skips, os |
| 287 | |
| 288 | def forward(self, x, skips, return_logits=False, return_list=None): |
| 289 | os = self.backbone_OS |
| 290 | out_dict = {} |
| 291 | |
| 292 | # run layers |
| 293 | x, skips, os = self.run_layer(x, self.dec5, skips, os) |
| 294 | if return_list and 'dec_4' in return_list: |
| 295 | out_dict['dec_4'] = x.detach().cpu() # 512, 64, 64 |
| 296 | x, skips, os = self.run_layer(x, self.dec4, skips, os) |
| 297 | if return_list and 'dec_3' in return_list: |
| 298 | out_dict['dec_3'] = x.detach().cpu() # 256, 64, 128 |
| 299 | x, skips, os = self.run_layer(x, self.dec3, skips, os) |
| 300 | if return_list and 'dec_2' in return_list: |
| 301 | out_dict['dec_2'] = x.detach().cpu() # 128, 64, 256 |
| 302 | x, skips, os = self.run_layer(x, self.dec2, skips, os) |
| 303 | if return_list and 'dec_1' in return_list: |
| 304 | out_dict['dec_1'] = x.detach().cpu() # 64, 64, 512 |
| 305 | x, skips, os = self.run_layer(x, self.dec1, skips, os) |
| 306 | if return_list and 'dec_0' in return_list: |
| 307 | out_dict['dec_0'] = x.detach().cpu() # 32, 64, 1024 |
| 308 | |
| 309 | logits = torch.clone(x).detach() |
| 310 | x = self.dropout(x) |
| 311 | |
| 312 | if return_logits: |
| 313 | return x, logits |
| 314 | if return_list is not None: |
| 315 | return out_dict |
| 316 | return x |
| 317 | |
| 318 | def get_last_depth(self): |
| 319 | return self.last_channels |