You could use flatten 3 or view on your input.
Sorry I don’t get it it. The sequence (and batch size) of input in output stays the same.
You can modify the shape with view if it makes sense for you.
lstm = nn.LSTM(32,256,1)
# x of dimension 16x2

y, hc = lstm(torch.view(1, 32), hc)
y = y.view(256,1)