2 ways of stacking rnn layers?

LSTM, from the official documents:

  • num_layers – Number of recurrent layers. E.g., setting num_layers=2 would mean stacking two LSTMs together to form a stacked LSTM, with the second LSTM taking in outputs of the first LSTM and computing the final results. Default: 1

So, if I want to stack a number of layers, say 2, I could just specify 2 as the num_layers, right?
But does it do the same way as the following code?