# Generative Adversarial Networks

**URL:** <https://d2l.discourse.group/t/generative-adversarial-networks/776>\
**Category:** pytorch\
**Created:** [August 24, 2020, 10:54am UTC](https://d2l.discourse.group/t/generative-adversarial-networks/776 "2020-08-24T10:54:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![StevenJokes](https://yyz2.discourse-cdn.com/free1/user_avatar/d2l.discourse.group/stevenjokes/32/437_2.png) [@StevenJokes](https://d2l.discourse.group/u/StevenJokes)\
**Post date:** [August 24, 2020, 10:54am UTC](https://d2l.discourse.group/t/generative-adversarial-networks/776/1 "2020-08-24T10:54:44Z")

</div>

[http://d2l.ai/chapter\_generative-adversarial-networks/gan.html](http://d2l.ai/chapter_generative-adversarial-networks/gan.html)

---

<div class="post-metadata">

**Author:** ![StevenJokes](https://yyz2.discourse-cdn.com/free1/user_avatar/d2l.discourse.group/stevenjokes/32/437_2.png) [@StevenJokes](https://d2l.discourse.group/u/StevenJokes)\
**Post date:** [September 4, 2020, 12:22pm UTC](https://d2l.discourse.group/t/generative-adversarial-networks/776/2 "2020-09-04T12:22:23Z")

</div>

[http://preview.d2l.ai/d2l-en/master/chapter\_generative-adversarial-networks/gan.html](http://preview.d2l.ai/d2l-en/master/chapter_generative-adversarial-networks/gan.html)

The loss of discriminator is better to be bigger.  
The loss of generator is better to be smaller.

* * *

I can’t figure out a question: [https://stackoverflow.com/questions/63763835/why-is-my-loss-of-generator-0-why-is-loss-of-discriminator-bigger-than-generato](https://stackoverflow.com/questions/63763835/why-is-my-loss-of-generator-0-why-is-loss-of-discriminator-bigger-than-generato)  
Anyone helps me?

---

<div class="post-metadata">

**Author:** ![goldpiggy](https://yyz2.discourse-cdn.com/free1/user_avatar/d2l.discourse.group/goldpiggy/32/10_2.png) [@goldpiggy](https://d2l.discourse.group/u/goldpiggy)\
**Post date:** [September 8, 2020, 8:56pm UTC](https://d2l.discourse.group/t/generative-adversarial-networks/776/3 "2020-09-08T20:56:34Z")

</div>

Hi @StevenJokes, we want to minimize both loss. Can you specify where do you see the following augment? Thanks

> [@StevenJokes](#):
>
> The loss of discriminator is better to be bigger.  
> The loss of generator is better to be smaller.

---

<div class="post-metadata">

**Author:** ![StevenJokes](https://yyz2.discourse-cdn.com/free1/user_avatar/d2l.discourse.group/stevenjokes/32/437_2.png) [@StevenJokes](https://d2l.discourse.group/u/StevenJokes)\
**Post date:** [September 9, 2020, 3:23am UTC](https://d2l.discourse.group/t/generative-adversarial-networks/776/4 "2020-09-09T03:23:26Z")

</div>

GAN:

 ![image](https://global.discourse-cdn.com/free1/uploads/d2l/original/1X/0a593d80ae59898cf71c67b92fd127e5b4cb8a5e.png)  
DCGAN:  
 ![image](https://global.discourse-cdn.com/free1/uploads/d2l/original/1X/68defd6c2ec427f768d5c5b7b04a29354c200e98.png)  
I forgot the book name… Too many books I have read…

* * *

I found 《深入浅出PyTorch：从模型到源码》writen by 张校捷

> **[GitHub - zxjzxj9/PyTorchIntroduction: 《深入浅出 PyTorch——从模型到源码》源代码和勘误（见Issues）](https://github.com/zxjzxj9/PyTorchIntroduction)**
>
> 《深入浅出 PyTorch——从模型到源码》源代码和勘误（见Issues）

GAN: [PyTorchIntroduction/Chapter4/gan.py at master · zxjzxj9/PyTorchIntroduction · GitHub](https://github.com/zxjzxj9/PyTorchIntroduction/blob/master/Chapter4/gan.py)  
4.7 生成模型：VAE和GAN

> 可以看到，生成器的损失函数的目的是让生成器的输出在判别器上输出的概率尽可能大，判别器的损失函数目的是让真实数据在判别器上输出的概率尽可能大（见式（4.11）第一项），而让生成器生成的输出在判别器上的概率尽可能小（见式（4.11）第二项）

LossD = -(logD(x) +log(1-D(G(z))) (4.11)

Do you understand Chinese? Just keep same to the passage.  
I have tried google translation to English, which is understandable for me.  
BTW, recommend a chrome extension [https://chrome.google.com/webstore/detail/沙拉查词-聚合词典划词翻译/cdonnmffkdaoajfknoeeecmchibpmkmg/reviews?hl=en](https://chrome.google.com/webstore/detail/%E6%B2%99%E6%8B%89%E6%9F%A5%E8%AF%8D-%E8%81%9A%E5%90%88%E8%AF%8D%E5%85%B8%E5%88%92%E8%AF%8D%E7%BF%BB%E8%AF%91/cdonnmffkdaoajfknoeeecmchibpmkmg/reviews?hl=en)  
It is convient to translate Chinese to Engish and English to Chinese.

 ![image](https://global.discourse-cdn.com/free1/uploads/d2l/original/1X/c804575c2cbec01b5be71a0e7ef60e7cc1282c88.png)

* * *

Will your team give me an AI job now?  
I really need to learn AI from working with you…  
Would you like to train me…
