pytorch tree lstm package
Project description
Tree LSTM
This repository contains a Pytorch Implementation of "Improved Semantic Representations From Tree-Structured Long Short-Term Memory Networks " (https://arxiv.org/abs/1503.00075).
This contains two type of tree-lstm (Child sum, N-ary). This was tested by Python 3.6, Pytorch 1.3.0., and this internally uses dgl 0.4.0
This repository referenced https://github.com/dmlc/dgl/blob/master/examples/pytorch/tree_lstm/tree_lstm.py
Installation
pip install tree-lstm
after installed, you can use this via
import TreeLSTM, Tree, BatchedTree
Usage
- make Tree object (initialize with arbitrary tensor)
- make BatchedTree object using list of Tree object
- make TreeLSTM object (inherited from torch.nn.Module)
- pass BatchedTree object into TreeLSTM object
For more detailed usage, please see test.py
Thanks for reporting issues / contributions / starts / watches!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for tree_lstm-0.0.8-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f41d7644af4bd665e80b00f02cd507fc3b31605ee168d6ab354930cb8f6f558f |
|
MD5 | 2840f802179535d37c8f960a89614371 |
|
BLAKE2b-256 | 3bfdeabb0e63d10e6662bc9e9ead9b1bb2906e54ec5d4d8248ca365a8aa9ad5d |