class_docstr: fastNLP中各种Embedding的基类
class_docstr_tok: ["fastNLP\u4e2d\u5404\u79cdEmbedding\u7684\u57fa\u7c7b"]
docstr: 按照设定随机将words设置为unknown_index。
  
  :param torch.LongTensor words: batch_size x max_len
  :return:
docstr_tok: ["\u6309\u7167\u8bbe\u5b9a\u968f\u673a\u5c06words\u8bbe\u7f6e\u4e3aunknown_index\u3002",":","param","torch.LongTensor","words",":","batch_size","x","max_len",":","return",":"]
code: def drop_word(self, words):
      r"""
      按照设定随机将words设置为unknown_index。
  
      :param torch.LongTensor words: batch_size x max_len
      :return:
      """
      if self.word_dropout > 0 and self.training:
          mask = torch.full_like(
              words,
              fill_value=self.word_dropout,
              dtype=torch.float,
              device=words.device,
          )
          mask = torch.bernoulli(mask).eq(1)  # dropout_word越大，越多位置为1
          pad_mask = words.ne(self._word_pad_index)
          mask = mask.__and__(pad_mask)
          words = words.masked_fill(mask, self._word_unk_index)
      return words
  
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 2 for calling the TokenEmbedding obj's underlying member method code with example usage: obj.drop_word(words) and returns: words