Open suatfk opened 5 years ago
Hi @suatfk, thanks for sharing! I'll wait before TensorFlow 2.0 to come before changing this.
Maybe that this problem was caused by an update or probably if you try to declare two tensors with the same name, hence why you would need get_variable
. Or maybe the global_variables_initializer
was overriding the values with zeros... interesting. I'll check that when refactoring.
Thanks for perfect work inspired me a lot.
Here is the story.
Im currently working with tensorflow.datasets.imdb dataset. i decided to use Glove word embeddings(300d) with my toy project but imdb dataset contains only word indexes like [1,3,515,...] not the words which mean basically comes with internal word index.
So i decided to convert this indexes to glove word embedding indexes to use embeddings. Here is conversation which i try to implement totally in tensorflow for learning purposes.
imdb_dataset -> imdb_index_to_word_dict -> glove_word_to_index -> glove_word_embedding [12, 325, 123,... ] -> ["the", "equal", "append"] -> [15, 645, 722,...] -> [[][]] (shape (n_word,300d))
Here is my code:
Here is the problem
When i tried to run every time this code block above glove_indices_result contains true values but somehow embedding return only default value with bunch of zeros.
and Here is the solution
i changed this code block when used loading tf_embedding ( embedding tensor)
with this
and it is working like charm now. Thanks for the perfect work and your time. This issue take half day from me so i dont want this issue take someone else's time.
Thank you.