a4697d7e45e66a3264eb56dcf489d67d4df40d23,implementations/cgan/cgan.py,Discriminator,forward,#Discriminator#,98
Before Change
label_emb = nn.Embedding(opt.n_classes, opt.img_size**2)(labels)
label_emb = label_emb.view(label_emb.shape[0], 1, opt.img_size, opt.img_size)
// Concatenate label embedding and image by channels
d_input = torch.cat((label_emb, img), 1)
feature_repr = self.model(d_input)
feature_repr = feature_repr.view(feature_repr.shape[0], -1)
validity = self.adv_layer(feature_repr)
After Change
def forward(self, img, labels):
// Concatenate label embedding and image by channels
d_input = torch.cat((img.view(img.size(0), -1), self.label_embedding(labels)), -1)
validity = self.model(d_input)
return validity
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 3
Instances
Project Name: eriklindernoren/PyTorch-GAN
Commit Name: a4697d7e45e66a3264eb56dcf489d67d4df40d23
Time: 2018-04-23
Author: eriklindernoren@gmail.com
File Name: implementations/cgan/cgan.py
Class Name: Discriminator
Method Name: forward
Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: 9b0a0dd6fe7b4ac021d91acc6b4f96b403dd6b67
Time: 2019-04-26
Author: eriklindernoren@live.se
File Name: models.py
Class Name: Darknet
Method Name: forward
Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 0e63a5cd9e6f50d996a2491a300f760c681d4349
Time: 2018-07-24
Author: ewijmans2@gmail.com
File Name: storage.py
Class Name: RolloutStorage
Method Name: recurrent_generator
Project Name: osmr/imgclsmob
Commit Name: 0c7d4353191b13cc2ec021b7adeeb41d44ca7054
Time: 2021-02-15
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/others/_espnet.py
Class Name: ESPNet
Method Name: forward