Comments (2)
@stationkl5
返信が遅くなり申し訳ありません。
with torch.no_grad()を必要とした意図としては、このステップでは生成器Gの学習のためのパラメータ計算をしている段階であり、識別器Dのパラメータはここでは更新したくないためです。
もしwith torch.no_grad()が存在しない場合、self.netD(fakeAB)を計算する時に勾配が自動的に計算され、識別器Dのパラメータが意図に反して更新されてしまいます。そのためwith torch.no_grad()が必要となります。
from gan_sample.
@takaaki5564
ご回答ありがとうございます。
生成機のパラメーターを、識別機をだませるパラメータに更新するために
lossG_GANを計算して生成機に逆伝搬させたいところですが、
lossG_GAN=criterionGAN(self.netD(self.netG(A),B)
を逆伝搬したくても
with torch.no_grad():
pred_fake = self.netD(fakeAB)
としていると、netDの勾配がないため、netGまで逆伝搬できず、生成機のパラメーターも更新できないのでないでしょうか?
from gan_sample.
Related Issues (16)
- esrganでgray-scale画像の高解像度化は可能でしょうか HOT 15
- EfficientGANをgary-scaleで試してますが、画像が不鮮明で_img_from_Zの画像のコントラストが低い HOT 37
- StyleGANに必要なmoduleを教えて下さい HOT 8
- 3D-α-WGAN-GPの応用について HOT 7
- RuntimeError occurred during training HOT 8
- コード内のVariable()について HOT 4
- style_gan2_pytorch/simple_upfirdn_2d.pyについて HOT 1
- photo2portraitデータセットにアクセスできません HOT 3
- section6_3_recycleGAN_pytorch_face.ipynbのReplayBufferが誤っている? HOT 1
- AnoGAN Fruits-360 dataset をダウンロードできない? HOT 4
- 出力の名称について HOT 3
- section7_1-training.ipynb のエラーについて HOT 7
- Updating: gan_sample/chapter7/requirements.txt HOT 1
- 電子書籍 HOT 4
- Windows 10における実行時のエラー "BrokenPipeError: [Errno 32] Broken pipe" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gan_sample.