It’s possible, but then you have to tell Pytorch so by using batch_first=True here:
    self.lstm = nn.LSTM(..., batch_first=True)

However, depending where you do it (the encoder, decoder, or both) you need to make other changes to the code. For example, when the decoder LSTM takes batch_first=True you probably have to change the following:
#input = input.unsqueeze(0)
input = input.unsqueeze(1)

#output = self.out(output[-1])
output = self.out(output[:, -1, :])

…and maybe other stuffm I’ve haven’t tested it, but batch_first=True also changes the shape of the output of the LSTM which naturally affects how to handle it for subsequent steps.