tensorflow / fold

Deep learning with dynamic computation graphs in TensorFlow
Apache License 2.0
1.82k stars 266 forks source link

word2vec in logits_and_save of sentiment.ipyb with dynamic vector of word #68

Open abhinavg4 opened 7 years ago

abhinavg4 commented 7 years ago

Hi,

I am working with tensor flow fold tree LSTM code. Before applying tree LSTM I'm doing some preprocessing on the sentence in tensorflow. To be concrete through preprocessing I'm getting a matrix (say R) of size NxMxD where N is the batch size, M is the max sentence length, D the representation dimension.

Now I want to apply TREE LSTM on this matrix R s.t. R_TL = TreeLSTM(R).

While using the sentiment.py code I'm facing problem while writing the word2vec code as now my vec representation are dynamic ( represented through R). For any word, it's vector representation would be R(batch_idx, word_inx, : ).

If batch consists of 2 setences : 0: It is a good day 1: He is a very good player. Then for the word good I will need R(0,3,:) one time and R(1, 4, :) other time.

I can give word_idx info with parse tree but how do I get the batch_idx info ?

Any other approach to this problem is also acceptable (My problem being how to take vec rep from a dynamic matrix)

Thanks