def get_embeddings(options, word_idict, f_emb, use_norm=False):
 d = OrderedDict()
 for i in range(options['n_words']):
  caption = [i]
  ff = f_emb(numpy.array(caption).reshape(1, 1)).flatten()
  if use_norm:
   ff /= norm(ff)
  d[word_idict[i]] = ff
 return d

def get_embeddings ( options , word_idict , f_emb , use_norm = False ) : d = OrderedDict ( ) for i in range ( options [ 'n_words' ] ) : caption = [ i ] ff = f_emb ( numpy . array ( caption ) . reshape ( 1 , 1 ) ) . flatten ( ) if use_norm : ff /= norm ( ff ) d [ word_idict [ i ] ] = ff return d
extract rnn embeddings from the lookup layer of the model function modified from: URL .