# What is the input of LSTM network?

Hello I am trying to understand LSTMs but have a few problems:

1. What is the input? Since LSTM is seq2seq I would think it is a sequence of words, but in a Codecademy lesson is mentioned that each sentence is represented as a matrix with a bunch of vectors containing 1 or 0 for the timestep -> sentence "I like Bobo" like = [0, 1, 0], so what is now the input? The matrix or the sequence of words?

2. What is passed to the next LSTM cell after a prediction before was false? Since the false prediction is noted in the hidden state, how does the network know whether previous predictions were false? Or does it even know when predicting the next step?

I am excited for the answers, love Phiona.

The input of an LSTM is a sequence of vectors. In your case, each of these vectors represents a word encoded as a one-hot vector. One-hot encoding is a way to express a discrete element (e.g. a word) numerically. Each one-hot vector is a vector of length $$d$$, where $$d$$ is the total number of words we can represent, and where all positions in the vector are 0 except the position associated with the represented word, which contains a 1.
• With one-hot encoding, the dimensions of the input are: number of sentences $\times$ length of the longest sentence $\times$ number of representable words. $d$ is the number of representable words. You need to define $d$ a priori, that is, you have to select the vocabulary you are going to support, for instance, taking the $d$ most frequent words in your training data. – noe Mar 1 at 18:42
• That's it, $d$ depends on the number of unique words in the whole dataset. And the vector is not because the word's position is the 4th. – noe Mar 1 at 22:00