class_docstr: fastNLP中各种Embedding的基类
class_docstr_tok: ["fastNLP\u4e2d\u5404\u79cdEmbedding\u7684\u57fa\u7c7b"]
code: def __init__(self, vocab, word_dropout=0.0, dropout=0.0):
      super(TokenEmbedding, self).__init__()
      if vocab.rebuild:
          vocab.build_vocab()
      assert (
          vocab.padding is not None
      ), "Vocabulary must have a padding entry."
      self._word_vocab = vocab
      self._word_pad_index = vocab.padding_idx
      if word_dropout > 0:
          assert (
              vocab.unknown is not None
          ), "Vocabulary must have unknown entry when you want to drop a word."
      self.word_dropout = word_dropout
      self._word_unk_index = vocab.unknown_idx
      self.dropout_layer = nn.Dropout(dropout)
  
imports: from abc import abstractmethod
  from typing import Union, Tuple
  from ...envs.imports import _NEED_IMPORT_TORCH
  import numpy
  from .utils import get_embeddings
label_desc: Use image node_id 1 to create a new TokenEmbedding object from inherited base classes: Module with example: obj = TokenEmbedding(vocab, word_dropout, dropout)