Update loss with lr crossgan

This commit is contained in:
James Betker 2020-08-26 17:57:22 -06:00
parent 80aa83bfd2
commit 25832930db

View File

@ -26,7 +26,7 @@ class GANLoss(nn.Module):
self.real_label_val = real_label_val
self.fake_label_val = fake_label_val
if self.gan_type in ['gan', 'ragan', 'pixgan', 'pixgan_fea', 'crossgan']:
if self.gan_type in ['gan', 'ragan', 'pixgan', 'pixgan_fea', 'crossgan', 'crossgan_lrref']:
self.loss = nn.BCEWithLogitsLoss()
elif self.gan_type == 'lsgan':
self.loss = nn.MSELoss()
@ -40,7 +40,7 @@ class GANLoss(nn.Module):
return torch.empty_like(input).fill_(self.fake_label_val)
def forward(self, input, target_is_real):
if self.gan_type in ['pixgan', 'pixgan_fea', 'crossgan'] and not isinstance(target_is_real, bool):
if self.gan_type in ['pixgan', 'pixgan_fea', 'crossgan', 'crossgan_lrref'] and not isinstance(target_is_real, bool):
target_label = target_is_real
else:
target_label = self.get_target_label(input, target_is_real)