(self, x, mask)
| 400 | self.attention = nn.Sequential(*[attention_conv, attention_sigmoid]) |
| 401 | |
| 402 | def forward(self, x, mask): |
| 403 | if self.outermost: |
| 404 | x = self.down(x) |
| 405 | x = self.submodule(x, mask) |
| 406 | ret = self.up(x) |
| 407 | return ret |
| 408 | elif self.innermost: |
| 409 | ret = self.up(x) |
| 410 | if self.upnorm._get_name() in self.norm_namebuffer: |
| 411 | ret = self.upnorm(ret, mask) |
| 412 | else: |
| 413 | ret = self.upnorm(ret) |
| 414 | ret = torch.cat([x, ret], 1) |
| 415 | if self.use_attention: |
| 416 | return self.attention(ret) * ret |
| 417 | return ret |
| 418 | else: |
| 419 | ret = self.down(x) |
| 420 | if self.downnorm._get_name() in self.norm_namebuffer: |
| 421 | ret = self.downnorm(ret, mask) |
| 422 | else: |
| 423 | ret = self.downnorm(ret) |
| 424 | ret = self.submodule(ret, mask) |
| 425 | ret = self.up(ret) |
| 426 | if self.upnorm._get_name() in self.norm_namebuffer: |
| 427 | ret = self.upnorm(ret, mask) |
| 428 | else: |
| 429 | ret = self.upnorm(ret) |
| 430 | if self.use_dropout: # only works for middle features |
| 431 | ret = self.dropout(ret) |
| 432 | ret = torch.cat([x, ret], 1) |
| 433 | if self.use_attention: |
| 434 | return self.attention(ret) * ret |
| 435 | return ret |
| 436 | |
| 437 | |
| 438 | class PartialConv2d(nn.Conv2d): |
nothing calls this directly
no outgoing calls
no test coverage detected