Skip to content

Instantly share code, notes, and snippets.

@sjain07
Created January 31, 2017 09:31
Show Gist options
  • Save sjain07/3e9ef53a462a9fc065511aeecdfc22fd to your computer and use it in GitHub Desktop.
Save sjain07/3e9ef53a462a9fc065511aeecdfc22fd to your computer and use it in GitHub Desktop.
with tf.Session(graph=graph) as session:
init.run()
average_loss = 0
for step in range(10001):
batch_inputs, batch_labels = generate_batch(batch_size, num_skips, skip_window)
feed_dict = {train_inputs: batch_inputs, train_labels: batch_labels}
_, loss_val, normalized_embeddings_np = session.run([optimizer, loss, normalized_embeddings], feed_dict=feed_dict)
average_loss += loss_val
final_embeddings = normalized_embeddings.eval()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment