code
stringlengths
3
6.57k
super(tdecode_ResidualBlock, self)
__init__()
nn.ConvTranspose2d(in_channels=8*in_features,out_channels=4*in_features,kernel_size=(3, 3)
nn.BatchNorm2d(4*in_features)
nn.LeakyReLU(inplace=True)
nn.ConvTranspose2d(in_channels=4*in_features,out_channels=1*in_features,kernel_size=(3, 3)
nn.BatchNorm2d(1*in_features)
nn.LeakyReLU(inplace=True)
forward(self, encode_x)
self.tdecode_block(encode_x)
F.sigmoid(decode_x)
target_encode_Generator(nn.Module)
__init__(self)
super(target_encode_Generator, self)
__init__()
nn.Linear(opt.latent_dim, opt.channels*opt.img_size**2)
nn.Sequential(nn.Conv2d(opt.channels*2, 64, 3, 1, 1)
nn.ReLU(inplace=True)
range(opt.n_residual_blocks)
resblocks.append(tencode_ResidualBlock()
nn.Sequential(*resblocks)
forward(self, img, z)
torch.cat((img, self.tfc(z)
view(*img.shape)
self.tl1(gen_input)
self.tencode_resblocks(out)
source_encode_Generator(nn.Module)
__init__(self)
super(source_encode_Generator, self)
__init__()
nn.Linear(opt.latent_dim, opt.channels*opt.img_size**2)
nn.Sequential(nn.Conv2d(opt.channels*2, 64, 3, 1, 1)
nn.ReLU(inplace=True)
range(opt.n_residual_blocks)
resblocks.append(sencode_ResidualBlock()
nn.Sequential(*resblocks)
forward(self, img, z)
torch.cat((img, self.sfc(z)
view(*img.shape)
self.sl1(gen_input)
self.sencode_resblocks(out)
target_decode_Generator(nn.Module)
__init__(self)
super(target_decode_Generator, self)
__init__()
range(opt.n_residual_blocks)
resblocks.append(tdecode_ResidualBlock()
nn.Sequential(*resblocks)
nn.Sequential(nn.Conv2d(64, opt.channels, 3, 1, 1)
nn.Tanh()
forward(self, img, encode_out)
self.target_decode_resblocks(encode_out)
self.tl2(out)
source_decode_Generator(nn.Module)
__init__(self)
super(source_decode_Generator, self)
__init__()
range(opt.n_residual_blocks)
resblocks.append(sdecode_ResidualBlock()
nn.Sequential(*resblocks)
nn.Sequential(nn.Conv2d(64, opt.channels, 3, 1, 1)
nn.Tanh()
forward(self, img, encode_out)
self.source_decode_resblocks(encode_out)
self.sl2(out)
encode_Discriminator(nn.Module)
__init__(self)
super(encode_Discriminator, self)
__init__()
block(in_features, out_features, normalization=True)
nn.Conv2d(in_features, out_features, 3, stride=2, padding=1)
nn.LeakyReLU(0.2, inplace=True)
layers.append(nn.InstanceNorm2d(out_features)
block(256, 512, normalization=False)
block(512, 1024)
nn.Conv2d(1024, 1, 3, 1, 1)
forward(self, encode_x)
self.model(encode_x)
Discriminator(nn.Module)
__init__(self)
super(Discriminator, self)
__init__()
block(in_features, out_features, normalization=True)
nn.Conv2d(in_features, out_features, 3, stride=2, padding=1)
nn.LeakyReLU(0.2, inplace=True)
layers.append(nn.InstanceNorm2d(out_features)
block(opt.channels, 64, normalization=False)
block(64, 128)
block(128, 256)
block(256, 512)
nn.Conv2d(512, 1, 3, 1, 1)
forward(self, img)
self.model(img)
encode_Classifier(nn.Module)
__init__(self)
super(encode_Classifier, self)
__init__()
block(in_features, out_features, normalization=True)
nn.Conv2d(in_features, out_features, 3, stride=2, padding=1)
nn.LeakyReLU(0.2, inplace=True)