code: def encode_sentence(enc_fwd_lstm, enc_bwd_lstm, sentence):
      sentence_rev = list(reversed(sentence))
  
      fwd_vectors = run_lstm(enc_fwd_lstm.initial_state(), sentence)
      bwd_vectors = run_lstm(enc_bwd_lstm.initial_state(), sentence_rev)
      bwd_vectors = list(reversed(bwd_vectors))
      vectors = [
          dy.concatenate(list(p)) for p in zip(fwd_vectors, bwd_vectors)
      ]
  
      return vectors
  
file_path: dynet/examples/sequence-to-sequence/attention.py
imports: import dynet
  import random
label_desc: Use image node_id 3 for calling a global function with example usage: encode_sentence(enc_fwd_lstm, enc_bwd_lstm, sentence) and returns: vectors