code: def apply_regressor(
      clf, w2v_W, w2v_vocab, orig_word_vectors, word_idict
  ):
      """
      Map words from word2vec into RNN word space
  
      Function modifed from:
      https://github.com/ryankiros/skip-thoughts/blob/master/training/tools.py
      """
      init_embed = clf.be.zeros((len(w2v_vocab), 620), dtype=np.float32)
  
      word_vec = clf.be.empty((300, 1))
  
      # to apply the regression model for expansion, can only do one word at a time
      # so to set the actual batch_size to be 1
      actual_bsz = 1
      clf.set_batch_size(N=actual_bsz)
  
      for i, w in enumerate(w2v_vocab.keys()):
          word_vec.set(w2v_W[w2v_vocab[w]].reshape(300, 1))
          init_embed[w2v_vocab[w]][:] = clf.fprop(word_vec)[
              :, :actual_bsz
          ]
  
      word_vec_l = clf.be.empty((620, 1))
      for w in word_idict.values():
          if w in w2v_vocab:
              word_vec_l.set(orig_word_vectors[w])
              init_embed[w2v_vocab[w]][:] = word_vec_l
  
      return init_embed.get()
  
imports: import os
  import numpy
  from collections import defaultdict, OrderedDict
  from neon.layers import LookupTable, RecurrentSum, RecurrentLast, Linear, Bias, GeneralizedCost
  from neon.initializers import Gaussian, Constant
  from neon.data import ArrayIterator
  from neon.data.text_preprocessing import clean_string
  from neon.optimizers import GradientDescentMomentum
  from neon.transforms import SumSquared
  from neon.callbacks.callbacks import Callbacks
  from neon.models import Model
  from neon.util.persist import load_obj, save_obj
  from neon import logger
label_desc: Use image node_id 8 for calling a global function with example usage: apply_regressor(clf, w2v_W, w2v_vocab, orig_word_vectors, word_idict) and returns: init_embed