The most important thing is here to turn lists of ragged vectors to matrices with some padding value.