Comments (6)
Restart and run kernel using the following inplace of cell number 4 of the original notebook:
sess = tf.Session()
batch_size = 50
z_dimensions = 100
x_placeholder = tf.placeholder("float", shape = [None,28,28,1], name='x_placeholder')
Gz = generator(batch_size, z_dimensions)
Dx = discriminator(x_placeholder)
with tf.variable_scope(tf.get_variable_scope()) as scope:
pass
Dg = discriminator(Gz, reuse=True)
g_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dg, labels=tf.ones_like(Dg)))
d_loss_real = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dx, labels=tf.fill([batch_size, 1], 0.9)))
d_loss_fake = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dg, labels=tf.zeros_like(Dg)))
d_loss = d_loss_real + d_loss_fake
tvars = tf.trainable_variables()
d_vars = [var for var in tvars if 'd_' in var.name]
g_vars = [var for var in tvars if not 'g_' in var.name]
with tf.variable_scope(scope):
d_trainer_fake = tf.train.AdamOptimizer(0.0001).minimize(d_loss_fake, var_list=d_vars)
d_trainer_real = tf.train.AdamOptimizer(0.0001).minimize(d_loss_real, var_list=d_vars)
g_trainer = tf.train.AdamOptimizer(0.0001).minimize(g_loss, var_list=g_vars)
from generative_adversarial_networks_live.
I made some necessary namescope fixes to run the code on my machine where I use Tensorflow 1.2.
I've submitted a PR which is here: #3
from generative_adversarial_networks_live.
The fix from RanaivosonHerimanitra lets the code run, but does not yield correct result.
Change this line from his code should correct it (remove not ):
g_vars = [var for var in tvars if 'g_' in var.name]
If you also want the code run continuously, change the plt.plot part to:
plt.imshow(im.reshape([28, 28]), cmap='Greys')
plt.show(block=False)
plt.pause(2)
plt.close()
from generative_adversarial_networks_live.
does anybody know how to solve this problem? unless this piece of code is useless
from generative_adversarial_networks_live.
The fix from RanaivosonHerimanitra solves the problem. Thank you.
from generative_adversarial_networks_live.
with tf.variable_scope(scope,reuse=tf.AUTO_REUSE):
optimizer_step=tf.train.AdamOptimizer(0.0001).minimized(loss, var)
from generative_adversarial_networks_live.
Related Issues (10)
- Variable d_w1/Adam/ does not exist HOT 1
- Generator's biases initialized with truncated normal instead of constant
- g_loss = tf.reduce_mean(tf.nn.sigmoid_cross_entropy_with_logits(logits=Dg, labels=tf.ones_like(Dg)))
- Initialization of biases in Generator and Discriminator
- Error in generator loss
- Declared variable not being found on the scope HOT 2
- Notebook text
- docs : math symbol
- d_loss_real calculated against 0.9?
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 generative_adversarial_networks_live.