Created
May 18, 2018 12:23
-
-
Save gonzaloruizdevilla/c9224e6bdf768710d438f3c74590fceb to your computer and use it in GitHub Desktop.
Word2vec compute loss
This file contains hidden or 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
# Compute the NCE loss, using a sample of the negative labels each time. | |
loss = tf.reduce_mean( | |
tf.nn.nce_loss(weights=nce_weights, | |
biases=nce_biases, | |
labels=train_labels, | |
inputs=embed, | |
num_sampled=num_sampled, | |
num_classes=vocabulary_size)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment