Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TF2] add GAN #1716

Closed
wants to merge 5 commits into from
Closed

[TF2] add GAN #1716

wants to merge 5 commits into from

Conversation

StevenJokess
Copy link
Contributor

loss_D 0.683, loss_G 0.683, 267.2 examples/sec
Check https://github.com/StevenJokess/d2l-en-read/blob/moreme/chapter-generative-adversarial-networks/gan-tf-ok/gan_tf6%20(3).ipynb

Description of changes:

By submitting this pull request, I confirm that you can use, modify,
copy, and redistribute this contribution, under the terms of your
choice.

@mli
Copy link
Member

mli commented Apr 11, 2021

Job d2l-en/PR-1716/4 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1716/

@StevenJokess
Copy link
Contributor Author

使用 tf.function 加快训练步骤的速度
TensorFlow 2.0 中的默认运行时为 Eager Execution。因此,上面的训练循环会以 Eager 模式执行。

这对于调试非常有用,但计算图编译具有确定的性能优势。将您的计算描述为静态计算图可以使框架应用全局性能优化。当框架受约束而以贪心方式一个接一个地执行运算,而又不知道接下来会发生什么时,便无法做到这一点。

以张量为输入的任何函数都可以编译为静态计算图。只需添加一个 @tf.function 装饰器,具体如下所示:


@tf.function

https://tensorflow.google.cn/guide/keras/writing_a_training_loop_from_scratch?hl=zh-cn
@mli
Copy link
Member

mli commented Apr 12, 2021

Job d2l-en/PR-1716/5 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1716/

@StevenJokess StevenJokess changed the title [TF] add GAN [TF2] add GAN Apr 13, 2021
@mli
Copy link
Member

mli commented Apr 13, 2021

Job d2l-en/PR-1716/6 is complete.
Check the results at http://preview.d2l.ai/d2l-en/PR-1716/

@astonzhang
Copy link
Member

https://discuss.d2l.ai/t/topic/2563

Again, please stop any inappropriate conduct on all channels of D2L. Since this is not the first violation of our code of conduct, we'll welcome you back once you learn how to behave properly and secure a job (this was already mentioned before). Good luck.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants