class_docstr: A layer of a model that replaces word IDs with their embeddings.
  
  This is a useful abstraction for any nn.module which wants to take word IDs
  (a sequence of text) as input layer but actually manipulate words'
  embeddings.
  
  Requires some pre-trained embedding with associated word IDs.
code: def __init__(
      self,
      n_d=100,
      embedding_matrix=None,
      word_list=None,
      oov="<oov>",
      pad="<pad>",
  ):
      word2id = {}
      if embedding_matrix is not None:
          for word in word_list:
              assert (
                  word not in word2id
              ), "Duplicate words in pre-trained embeddings"
              word2id[word] = len(word2id)
  
          logger.debug(
              f"{len(word2id)} pre-trained "
              f"word embeddings loaded.\n"
          )
  
          n_d = len(embedding_matrix[0])
  
      if oov not in word2id:
          word2id[oov] = len(word2id)
  
      if pad not in word2id:
          word2id[pad] = len(word2id)
  
      self.word2id = word2id
      self.vocab_size, self.embedding_size = len(word2id), n_d
  
      self.embedding = np.random.normal(
          size=(self.vocab_size, self.embedding_size)
      ).astype(np.float32)
  
      if embedding_matrix is not None:
          self.embedding[: len(embedding_matrix)] = np.array(
              embedding_matrix
          ).astype(np.float32)[:]
  
      self.oovid = word2id[oov]
      self.padid = word2id[pad]
  
file_path: textflint/textflint/input/model/test_model/glove_embedding.py
imports: import os
  import numpy
  import textattack
  from ....common.utils import logger, download_if_needed
label_desc: Use image node_id 1 to create a new Embedding object  with example: obj = Embedding(n_d, embedding_matrix, word_list, oov, pad)