This is a modification of an example provided at https://github.com/Element-Research/rnn#rnn.Recurrent