Does a stacked LSTM share a weight matrix?

If I’m using an LSTM and set num_layers to some number other than 1, do all layers share the same weights?

No each layer has different weights and biases

1 Like

Is it possible to get a different hidden size for each layer?

The easiest way would be to create different LSTMs like in example

first = nn.LSTM(input_size=input_size1,hidden_size=hidden_size1,num_layers=num_layers1)
second= nn.LSTM(input_size=hidden_size1,hidden_size=hidden_size2,num_layers=num_layers2)

Seems straightforward enough. Thank you. I wonder if there’s any advantage to doing this?