Keras’s LSTM layer includes a single flag to flatten the output into 1xN-hidden dimensions.
https://keras.io/layers/recurrent/ 4
" * return_sequences : Boolean. Whether to return the last output in the output sequence, or the full sequence."
This allows you to process a sequence, convert it to a single embedding, and then pass that to something like a classifier. I don’t want to go token by token. I want to take a sequence of arbitrary length and flatten it to a fixed embedding.
I know there are guides and explanations for how to do this in Pytorch but there are many mistakes and contradictions across different sources. There is a lot of quick speculation, and I’d like a definitive answer if it exists in documentation or example code.
The best diagram I’ve found is here

  
      stackoverflow.com
  
  
      
    
  

  What's the difference between "hidden" and "output" in PyTorch LSTM? 120



  pytorch



  asked by
  
  
    Nathaniel
  
  on 01:54PM - 17 Jan 18 UTC


  
  
    
    
  
  


Even for people writing tutorials there is confusion about what to do

  
      github.com/yunjey/pytorch-tutorial
  
  
    



Issue: output of bidirectional LSTM 34


	
	opened by hwijeen
	on 2018-12-06
	
	
	


First of all, thanks for your great tutorial on pytorch! It's a great tip for beginners.
I have a question about the...