code: def load_glove(filename, vocab, word_vecs):
      """Loads embeddings in the glove text format in which each line is
      '<word-string> <embedding-vector>'. Dimensions of the embedding vector
      are separated with whitespace characters.
  
      Args:
          filename (str): Path to the embedding file.
          vocab (dict): A dictionary that maps token strings to integer index.
              Tokens not in :attr:`vocab` are not read.
          word_vecs: A 2D numpy array of shape `[vocab_size, embed_dim]`
              which is updated as reading from the file.
  
      Returns:
          The updated :attr:`word_vecs`.
      """
      with gfile.GFile(filename) as fin:
          for line in fin:
              vec = line.strip().split()
              if len(vec) == 0:
                  continue
              word, vec = vec[0], vec[1:]
              word = tf.compat.as_text(word)
              if word not in vocab:
                  continue
              if len(vec) != word_vecs.shape[1]:
                  raise ValueError(
                      "Inconsistent word vector sizes: %d vs %d"
                      % (len(vec), word_vecs.shape[1])
                  )
              word_vecs[vocab[word]] = np.array([float(v) for v in vec])
      return word_vecs
  
file_path: texar/texar/tf/data/embedding.py
imports: import tensorflow
  from tensorflow import gfile
  import numpy
  from texar.tf.utils import utils
  from texar.tf.hyperparams import HParams
label_desc: Use image node_id 2 for calling a global function with example usage: load_glove(filename, vocab, word_vecs) and returns: word_vecs