As you say The forward() method on LSTM returns a tensor of shape (sequence_length, num sequences in batch, input size).  , if you  want the all elements in y, just use it. However, if you just wanna the lasted element in y, you can index it with

fx[-1]

It depends on what you want and the task.