(self, n_upsample, n_res, dim, output_dim, norm='batch', activ='relu', pad_type='zero', nz=0)
| 720 | |
| 721 | class Decoder_all(nn.Module): |
| 722 | def __init__(self, n_upsample, n_res, dim, output_dim, norm='batch', activ='relu', pad_type='zero', nz=0): |
| 723 | super(Decoder_all, self).__init__() |
| 724 | # AdaIN residual blocks |
| 725 | self.resnet_block = ResBlocks(n_res, dim, norm, activ, pad_type=pad_type, nz=nz) |
| 726 | self.n_blocks = 0 |
| 727 | # upsampling blocks |
| 728 | for i in range(n_upsample): |
| 729 | block = [Upsample2(scale_factor=2), Conv2dBlock(dim + nz, dim // 2, 5, 1, 2, norm='ln', activation=activ, pad_type='reflect')] |
| 730 | setattr(self, 'block_{:d}'.format(self.n_blocks), nn.Sequential(*block)) |
| 731 | self.n_blocks += 1 |
| 732 | dim //= 2 |
| 733 | # use reflection padding in the last conv layer |
| 734 | setattr(self, 'block_{:d}'.format(self.n_blocks), Conv2dBlock(dim + nz, output_dim, 7, 1, 3, norm='none', activation='tanh', pad_type='reflect')) |
| 735 | self.n_blocks += 1 |
| 736 | |
| 737 | def forward(self, x, y=None): |
| 738 | if y is not None: |
nothing calls this directly
no test coverage detected