Skip to content

Instantly share code, notes, and snippets.

@eisenjulian
Last active March 4, 2018 23:37
Show Gist options
  • Save eisenjulian/054634b88c66e34a7b7dbb0964a998fb to your computer and use it in GitHub Desktop.
Save eisenjulian/054634b88c66e34a7b7dbb0964a998fb to your computer and use it in GitHub Desktop.
embedding_matrix = np.random.uniform(-1, 1, size=(vocab_size, embedding_size))
for w, i in word_index.items():
v = embeddings.get(w)
if v is not None and i < vocab_size:
embedding_matrix[i] = v
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment