Last active
May 25, 2020 22:21
-
-
Save eustin/2a33efa5f2b5c398de433e5640246376 to your computer and use it in GitHub Desktop.
This file contains 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
num_classes = len(index_word) | |
index_one_hot = {i: tf.one_hot(x, depth=num_classes) \ | |
for i, x in enumerate(index_word.keys())} | |
for k, v in index_one_hot.items(): | |
word = index_word[k] | |
one_hot_vector = v.numpy() | |
print(f"{word:<6}: {one_hot_vector}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment