An implementation (in pyTorch and MXNet) of the N-ary Tree LSTM described in the paper Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks,Kai Sheng Tai, Richard Socher, and Christopher Manning.
Note: "For large values of N (the allowed maximum number of child), these additional parameters are impractical and may be tied or fixed to zero."
This N-aryTreeLSTM can be use to process the Syntax Tree:
Requirements:
- mxnet
- nltk
Usage example:
encoder = N_aryTreeLstm()
encoder.initialize(ctx=ctx)
c, h = self.encoder(tree, inputs, 0, ctx)