# GAN loss curve Weird

**URL:** <https://discuss.pytorch.org/t/gan-loss-curve-weird/67015>\
**Category:** vision\
**Created:** [January 18, 2020, 7:29am UTC](https://discuss.pytorch.org/t/gan-loss-curve-weird/67015 "2020-01-18T07:29:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![davidlee](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/davidlee/32/12812_2.png) [@davidlee](https://discuss.pytorch.org/u/davidlee)\
**Post date:** [January 18, 2020, 7:29am UTC](https://discuss.pytorch.org/t/gan-loss-curve-weird/67015/1 "2020-01-18T07:29:18Z")

</div>

![image](https://discuss.pytorch.org/uploads/default/original/3X/e/3/e32855f94b70928ffbab2cd77422cb51ab93eee0.png)

Hi,  
Like the picture attached, I’m undergoing the abnormal loss curve situation.  
Do you know how to solve this?

---

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [January 18, 2020, 3:50pm UTC](https://discuss.pytorch.org/t/gan-loss-curve-weird/67015/2 "2020-01-18T15:50:04Z")

</div>

Without knowing anything about your use case, I would suggest to play around with some hyperparameters and if that doesn’t help, dig deeper into the model architecture.

---

<div class="post-metadata">

**Author:** ![davidlee](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/davidlee/32/12812_2.png) [@davidlee](https://discuss.pytorch.org/u/davidlee)\
**Post date:** [January 19, 2020, 3:30am UTC](https://discuss.pytorch.org/t/gan-loss-curve-weird/67015/3 "2020-01-19T03:30:19Z")

</div>

I appreciate with your help, ptrblck However i have one more quick questions,

What is an ideal loss curve of G and D when i use the criterion as “torch.nn.BCELoss”?

```
criterion = torch.nn.BCELoss()
outputs= = D(real_images, y)
real_loss = criterion(outputs, real_labels)
outputs = D(fake_images, y)
fake_loss = criterion(outputs, fake_labels)     
d_loss = real_loss + fake_loss

g_loss = criterion(discriminator_outputs, real_labels)

```

Should both G\_loss and D\_loss be decreasing?  
or D\_loss should be decreasing while the G\_loss should be increasing??  
And Can i just sum real and fake loss for D\_loss or should they be averaged for D\_loss?

And my case, i want to generate numeric features with 12 dimensions like attached.

 ![스크린샷 2020-01-19 오후 12.24.03](https://discuss.pytorch.org/uploads/default/original/3X/5/5/556ff8367ca65f3df47110c3c16da58a35ae67fb.png)
