I want to know the difference between the LSTM and LSTMCell in the pytorch document?And how to use it correctly.
LSTMCell takes ONE input x_t. You need to make a loop in order to do one pass of backprop through time.
LSTM takes a SEQUENCE of inputs x_1,x_2,…,x_T. No need to write a loop to do one pass of backprop through time.
ok, Thanks for your answer, Is there any other difference?
@tlaurent ok, Thanks for your answer, Is there any other difference?
I would guess that using LSTM() is faster than writing your own loop with LSTMCell (because it is optimized by cudnn).
@tlaurent ok thanks gor your answer, I will try it.
LSTMCell() is the building block of the LSTM(). In LSTM(), there are multiple LSTMCell() in one layer as equal as sequence length or unrolling length of network.
I made this example, I hope it helps RNNs/LSTMCellvsLSTM.ipynb at main · CarlosJose126/RNNs · GitHub