Hands On Machine Learning, 2ed, Chapter 16: Natural Language Processing with RNNs and Attention, Excercise 8.