Created
August 27, 2018 20:47
-
-
Save Tathagatd96/b424ee988ee4a8d0caf730701c499a8d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
samples=[] #generator examples | |
with tf.Session() as sess: | |
sess.run(init) | |
for epoch in range(epochs): | |
num_batches=mnist.train.num_examples//batch_size | |
for i in range(num_batches): | |
batch=mnist.train.next_batch(batch_size) | |
batch_images=batch[0].reshape((batch_size,784)) | |
batch_images=batch_images*2-1 | |
batch_z=np.random.uniform(-1,1,size=(batch_size,100)) | |
_=sess.run(D_trainer,feed_dict={real_images:batch_images,z:batch_z}) | |
_=sess.run(G_trainer,feed_dict={z:batch_z}) | |
print("on epoch{}".format(epoch)) | |
sample_z=np.random.uniform(-1,1,size=(1,100)) | |
gen_sample=sess.run(generator(z,reuse=True),feed_dict={z:sample_z}) | |
samples.append(gen_sample) | |
plt.imshow(samples[0].reshape(28,28)) | |
plt.imshow(samples[99].reshape(28,28)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment