File tree 1 file changed +4
-6
lines changed 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -109,8 +109,9 @@ def training(opt):
109
109
110
110
# ~~~~~~~~~~~~~~~~~~~ discriminator loop ~~~~~~~~~~~~~~~~~~~ #
111
111
112
+ fake = gen (fixed_noise ) # dim of (N,1,W,H)
113
+
112
114
for _ in range (CRITIC_TRAIN_STEPS ):
113
- fake = gen (fixed_noise ) # dim of (N,1,W,H)
114
115
115
116
# ~~~~~~~~~~~~~~~~~~~ forward ~~~~~~~~~~~~~~~~~~~ #
116
117
@@ -126,7 +127,7 @@ def training(opt):
126
127
# ~~~~~~~~~~~~~~~~~~~ backward ~~~~~~~~~~~~~~~~~~~ #
127
128
128
129
critic .zero_grad ()
129
- C_loss .backward ()
130
+ C_loss .backward (retain_graph = True )
130
131
critic_optim .step ()
131
132
132
133
# ~~~~~~~~~~~ weight cliping as per WGAN paper ~~~~~~~~~~ #
@@ -136,12 +137,9 @@ def training(opt):
136
137
137
138
# ~~~~~~~~~~~~~~~~~~~ generator loop ~~~~~~~~~~~~~~~~~~~ #
138
139
139
- fake = gen (fixed_noise )
140
-
141
140
# ~~~~~~~~~~~~~~~~~~~ forward ~~~~~~~~~~~~~~~~~~~ #
142
141
143
- # make it one dimensional array
144
- fake_predict = critic (fake ).view (- 1 )
142
+ # re using the fake_predict from cirtic forward
145
143
146
144
# ~~~~~~~~~~~~~~~~~~~ loss ~~~~~~~~~~~~~~~~~~~ #
147
145
You can’t perform that action at this time.
0 commit comments