Skip to content

Instantly share code, notes, and snippets.

@Ruhshan
Last active December 9, 2017 17:36
Show Gist options
  • Save Ruhshan/0a8f61129cc4d577e1fe8e07b3d8b65b to your computer and use it in GitHub Desktop.
Save Ruhshan/0a8f61129cc4d577e1fe8e07b3d8b65b to your computer and use it in GitHub Desktop.
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
for epoch in range(n_epochs):
epoch_loss = 0
i=0
while i < len(train_x):
start = i
end = i+batch_size
batch_x = np.array(train_x[start:end])
batch_y = np.array(train_y[start:end])
_, c = sess.run([optimizer, cost], feed_dict={x: batch_x,
y: batch_y})
epoch_loss += c
i+=batch_size
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment