How to implement tree structured lstm as a recursive neural network in tensorflow?

231 views Asked by At

I was developing a tre_lstm for my sentiment analysis model and finally, I ran to an error which was about the various shape of input data. As each input text might have a different binary tree structure (and different number of lstm cells), the computation graph could not be static. However, in the https://github.com/sapruash/RecursiveNN, they have utilized pure TensorFlow to implement tree_lstm utilizing static computation graph. And I am developed as their source code but I get the aforementioned error about the shape of data. I did not want to use TensorFlow fold and PyTorch in order to exploit the dynamic computation graph. The error I get is this :

(0) Invalid argument: Shapes of all inputs must match: values[0].shape = [17] != values[2].shape = [23] [[node stack (defined at C:\Users\RAKA\Documents\tree_lstm\HSR_tree_lstm\tree_structured_lstm.py:150) ]]
line 150 :
batch_loss = tf.stack(outloss)

0

There are 0 answers