I don’t know which shape X_train has, but the sequences.view operation might be wrong, if you are trying to permute the dimensions.
By default nn.LSTM expects the input in the shape [seq_len, batch_size, features]. If you want to permute an input of [batch_size, seq_len, features] to this shape, use sequences = sequences.permute(1, 0, 2) instead.
The same applied for the lstm_out tensor, which has the shape [seq_len, batch_size, num_directions*hidden_size] by default.