Pytorch seq2seq

I have an encoder LSTM whose last hidden state feeds to the decoder LSTM. If i call backward on the loss for the decoder lstm, will the gradients propagate all the way back into the encoder as well, so that when i do decoder.step() and then encoder.step() both parameters are updated?

I feel as the same hidden state is being used, it should automatically take care of backpropagation to the encoder as well.