Nn.linear vs nn.Embedding for RNN, LSTM, or GRUs

I see some codes using nn.Embedding(input_size, hidden_size) and some other codes using just a linear module nn.Linear(input_size, hidden_size when mapping input to the hidden layer of RNN/LST/GRU units. What is the difference and what is the advantage of using one instead of the other?

3 Likes