MCPcopy Create free account
hub / github.com/JunlinHan/DCLGAN / __init__

Method __init__

models/networks.py:750–766  ·  view source on GitHub ↗
(self, n_upsample, n_res, dim, output_dim, norm='batch', activ='relu', pad_type='zero', nz=0)

Source from the content-addressed store, hash-verified

748
749class Decoder(nn.Module):
750 def __init__(self, n_upsample, n_res, dim, output_dim, norm='batch', activ='relu', pad_type='zero', nz=0):
751 super(Decoder, self).__init__()
752
753 self.model = []
754 # AdaIN residual blocks
755 self.model += [ResBlocks(n_res, dim, norm, activ, pad_type=pad_type, nz=nz)]
756 # upsampling blocks
757 for i in range(n_upsample):
758 if i == 0:
759 input_dim = dim + nz
760 else:
761 input_dim = dim
762 self.model += [Upsample2(scale_factor=2), Conv2dBlock(input_dim, dim // 2, 5, 1, 2, norm='ln', activation=activ, pad_type='reflect')]
763 dim //= 2
764 # use reflection padding in the last conv layer
765 self.model += [Conv2dBlock(dim, output_dim, 7, 1, 3, norm='none', activation='tanh', pad_type='reflect')]
766 self.model = nn.Sequential(*self.model)
767
768 def forward(self, x, y=None):
769 if y is not None:

Callers

nothing calls this directly

Calls 4

ResBlocksClass · 0.85
Upsample2Class · 0.85
Conv2dBlockClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected