No. Please take a look at the documentation to see the lstm or gru equations. What is learned are the weights. Hidden/cell states are calculated from previous time step’s hidden/cell state and the input at the current time step. So, when you run lstm over a sequence, you have the define the initial hidden/cell states.