Skip to content

Instantly share code, notes, and snippets.

@JoshVarty
Last active January 13, 2018 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshVarty/7a291654f88b79eb2fc4a1a1b3e2bbd1 to your computer and use it in GitHub Desktop.
Save JoshVarty/7a291654f88b79eb2fc4a1a1b3e2bbd1 to your computer and use it in GitHub Desktop.
with tf.Session(graph=graph) as session:
tf.global_variables_initializer().run()
num_steps = 1000
batch_size = 100
for step in range(num_steps):
offset = (step * batch_size) % (train_labels.shape[0] - batch_size)
batch_images = train_images[offset:(offset + batch_size), :]
batch_labels = train_labels[offset:(offset + batch_size), :]
feed_dict = {input: batch_images, labels: batch_labels}
o, c, = session.run([optimizer, cost], feed_dict=feed_dict)
print("Cost: ", c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment