How do you implement variable-length recurrent neural networks?
What is a full working example (not snippets) of variable-length sequence inputs into recurrent neural networks (RNNs)?  

For example PyTorch supposedly can implement variable-length sequences as input into RNNs, but there do not seem to be examples of full working code.  

Relevant:
https://github.com/pytorch/pytorch/releases/tag/v0.1.10
https://discuss.pytorch.org/t/about-the-variable-length-input-in-rnn-scenario/345

Sadly, there is no such thing as 'variable length' neural networks. This is because there is no way a network can 'know' which weights to use for extra input nodes that it wasn't trained for.

However, the reason you are seeing a 'variable length' on that page, is because they process:

a b c d e
a b c d e f g h
a b c d
a b


as 

a b c d e 0 0 0
a b c d e f g h
a b c d 0 0 0 0
a b 0 0 0 0 0 0


They convert all 'empty' variables to 0. Which makes sense, as 0 does not add anything tot he networks hidden layers regardless of the weights, as anything*0 = 0.

So basically, you can have 'variable length' inputs, but you have to define some kind of maximum size; all inputs that are smaller than that size should be padded with zeros.

If you are classifying sentences on the other hand, you could use LSTM/GRU networks to handle the input sequentially.
