July 2019
Intermediate to advanced
512 pages
19h 39m
English
Start the TensorFlow session and generate handwritten digits:
with tf.Session() as session:
Initialize all variables:
session.run(init)
To execute this for each epoch:
for epoch in range(num_epochs):
Select the number of batches:
num_batches = data.train.num_examples // batch_size
To execute this for each batch:
for i in range(num_batches):
Get the batch of data according to the batch size:
batch = data.train.next_batch(batch_size)
Reshape the data:
batch_images = batch[0].reshape((batch_size,784)) batch_images = batch_images * 2 - 1
Sample the batch noise:
batch_noise = np.random.uniform(-1,1,size=(batch_size,100))
Define the feed dictionaries with input x as batch_images and noise z as batch_noise ...
Read now
Unlock full access