Skip to content

Chanrom/pytorch-lstm-without-sorting-externally

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

pytorch-lstm-without-sorting-externally

In Pytorch, if we use torch.nn.LSTM and the input data are padded (i.e. a batch of variable-length sentences), then these data must be sorted by length and wrapped by torch.nn.utils.rnn.PackedSequence. Sometimes it's inconvenient to do that if we have n-pair data and want them to be interactive.

lstm.py implements a LSTM that can all these things internally. It wraps a standard Pytorch LSTM and sorts the input data automatically. The drawback is it slower than the standard Pytorch LSTM by 10%.

About

use pytorch lstm without manually sorting the padded data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages