figure - understanding how word embeddings are generated based on our model architecturethe embedding layer takes in three parameters--input_dimwhich is equal to the vocabulary size (vocab_sizeof output_dimwhich is representing the dimension of dense embedding (depicted by rows in the embedding layer in figure - )and input_lenwhich specifies the length of the input sequences (movie review sequence vectors)which is in the example depicted in figure - since we have one reviewthe dimension is ( this review is converted into numeric sequence [ based on the vocab_map then the specific columns representing the indices in the review sequence are selected from the embedding layer (vectors at column indices and respectively)to generate the final word embeddings this gives us an embedding vector of dimension ( also represented as ( when each row is represented based on each sequence word embedding vector many deep learning frameworks like keras represent the embedding dimensions as (mnwhere represents all the unique terms in our vocabulary ( and represents the output_dim which is in this case consider transposed version of the layer depicted in figure - and you are good to gousually if you have the encoded review terms sequence vector represented in one-hot encoded format ( and do matrix multiplication with the embedding layer represented as ( where each row represents the embedding for word in the vocabularyyou will directly obtain the word embeddings for the review sequence vector as ( the weights in the embedding layer get updated and optimized in each epoch based on the input data when propagated through the whole network like we mentioned earlier such that overall loss and error is minimized to get maximum model performance these dense word embeddings are then passed to the lstm layer having units we already introduced you to the lstm architecture briefly in in the subsection titled "long short term memory networksin the "important conceptssection under "deep learninglstms basically try to overcome the shortcomings of rnn models especially with regard to handling long term dependencies and problems which occur when the weight matrix associated with the units (neuronsbecome too small (leading to vanishing gradientor too large (leading to exploding gradientthese architectures are more complex than regular deep networks and going into detailed internals and math concepts would be out of the current scopebut we will try to cover the essentials here without making it math heavy if you're interested in researching the internals of lstmscheck out the original paper which inspired it allby hochreiters and schmidhuberj ( long short-term memory neural computation ( ) - we depict the basic architecture of rnns and compare it with lstms in figure -