I don’t know which input shaoe you are passing to the model, but would guess that hidden or cell is creating the shape mismatch.
Here is a small examples showing the hidden and cell outputs in the expected shape:
model = nn.LSTM(input_size=3, hidden_size=15, num_layers=2, batch_first=True)
x = torch.randn(1, 100, 3)
out, (hidden, cell) = model(x)

so check the shape of hidden and cell and make sure their shape matches the expected ones.