MCPcopy Create free account
hub / github.com/ali-vilab/dreamtalk / UpBlock2d

Class UpBlock2d

generators/base_function.py:284–296  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

282 return out
283
284class UpBlock2d(nn.Module):
285 def __init__(self, input_nc, output_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False):
286 super(UpBlock2d, self).__init__()
287 kwargs = {'kernel_size': 3, 'stride': 1, 'padding': 1}
288 conv = spectral_norm(nn.Conv2d(input_nc, output_nc, **kwargs), use_spect)
289 if type(norm_layer) == type(None):
290 self.model = nn.Sequential(conv, nonlinearity)
291 else:
292 self.model = nn.Sequential(conv, norm_layer(output_nc), nonlinearity)
293
294 def forward(self, x):
295 out = self.model(F.interpolate(x, scale_factor=2))
296 return out
297
298class FineADAINResBlocks(nn.Module):
299 def __init__(self, num_block, input_nc, feature_nc, norm_layer=nn.BatchNorm2d, nonlinearity=nn.LeakyReLU(), use_spect=False):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected