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

Class MappingF

models/networks.py:495–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

493 return self.l2norm(x_reshape)
494
495class MappingF(nn.Module):
496 def __init__(self, in_layer=4, gpu_ids=[], nc=256, patch_num=256, dim=64, init_type='normal', init_gain=0.02):
497 # hard-coded code.
498 super().__init__()
499 self.init_type = init_type
500 self.nc=nc
501 self.dim=dim
502 self.in_layer=in_layer
503 self.patch_num = patch_num
504 self.init_type = init_type
505 self.init_gain = init_gain
506 self.gpu_ids = gpu_ids
507 avg = nn.AdaptiveAvgPool2d(1)
508 conv = nn.Conv2d(in_layer, dim, 3, stride=2)
509 self.model = nn.Sequential(*[conv, nn.ReLU(), avg, nn.Flatten(), nn.Linear(dim,dim), nn.ReLU(), nn.Linear(dim, dim)])
510 init_net(self.model, self.init_type, self.init_gain, self.gpu_ids)
511 self.l2norm = Normalize(2)
512
513 def forward(self, x):
514 x = x.view(1, -1, self.patch_num, self.nc)
515 x = self.model(x)
516 x_norm = self.l2norm(x)
517 return x_norm
518
519
520class StridedConvF(nn.Module):

Callers 1

define_FFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected