Update loss with lr crossgan
This commit is contained in:
parent
80aa83bfd2
commit
25832930db
|
@ -26,7 +26,7 @@ class GANLoss(nn.Module):
|
||||||
self.real_label_val = real_label_val
|
self.real_label_val = real_label_val
|
||||||
self.fake_label_val = fake_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()
|
self.loss = nn.BCEWithLogitsLoss()
|
||||||
elif self.gan_type == 'lsgan':
|
elif self.gan_type == 'lsgan':
|
||||||
self.loss = nn.MSELoss()
|
self.loss = nn.MSELoss()
|
||||||
|
@ -40,7 +40,7 @@ class GANLoss(nn.Module):
|
||||||
return torch.empty_like(input).fill_(self.fake_label_val)
|
return torch.empty_like(input).fill_(self.fake_label_val)
|
||||||
|
|
||||||
def forward(self, input, target_is_real):
|
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
|
target_label = target_is_real
|
||||||
else:
|
else:
|
||||||
target_label = self.get_target_label(input, target_is_real)
|
target_label = self.get_target_label(input, target_is_real)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user