class_docstr: 更复杂的 Sequence Labelling 模型。结构为 ``Embedding``, ``LayerNorm``, :class:`BiLSTM <fastNLP.modules.torch.encoder.LSTM>` （两层），
  ``FC``，``LayerNorm``，``Dropout``，``FC``，:class:`CRF <fastNLP.modules.torch.decoder.ConditionalRandomField>`。
  
  :param embed: 支持以下几种输入类型：
  
      - ``tuple(num_embedings, embedding_dim)``，即 embedding 的大小和每个词的维度，此时将随机初始化一个 :class:`torch.nn.Embedding` 实例；
      - :class:`torch.nn.Embedding` 或 **fastNLP** 的 ``Embedding`` 对象，此时就以传入的对象作为 embedding；
      - :class:`numpy.ndarray` ，将使用传入的 ndarray 作为 Embedding 初始化；
      - :class:`torch.Tensor`，此时将使用传入的值作为 Embedding 初始化；
  :param hidden_size: :class:`~fastNLP.modules.torch.LSTM` 的隐藏层大小
  :param num_classes: 有多少个类
  :param dropout: :class:`~fastNLP.modules.torch.LSTM` 中以及 DropOut 层的 drop 概率
  :param id2words: tag id 转为其 tag word 的表。用于在 CRF 解码时防止解出非法的顺序，比如 **'BMES'** 这个标签规范中，``'S'``
      不能出现在 ``'B'`` 之后。这里也支持类似于 ``'B-NN'``，即 ``'-'`` 前为标签类型的指示，后面为具体的 tag 的情况。这里不但会保证
      ``'B-NN'`` 后面不为 ``'S-NN'`` 还会保证 ``'B-NN'`` 后面不会出现 ``'M-xx'`` （任何非 ``'M-NN'`` 和 ``'E-NN'`` 的情况）。
  :param encoding_type: 支持 ``["BIO", "BMES", "BEMSO"]`` ，只有在 ``id2words`` 不为 ``None`` 的情况有用。
class_docstr_tok: ["\u66f4\u590d\u6742\u7684","Sequence","Labelling","\u6a21\u578b\u3002\u7ed3\u6784\u4e3a","``","Embedding","``",",","``","LayerNorm","``",",",":","class",":","`","BiLSTM","<","fastNLP.modules.torch.encoder.LSTM",">","`","\uff08\u4e24\u5c42\uff09\uff0c","``","FC","``","\uff0c","``","LayerNorm","``","\uff0c","``","Dropout","``","\uff0c","``","FC","``","\uff0c",":","class",":","`","CRF","<","fastNLP.modules.torch.decoder.ConditionalRandomField",">","`","\u3002",":","param","embed",":","\u652f\u6301\u4ee5\u4e0b\u51e0\u79cd\u8f93\u5165\u7c7b\u578b\uff1a","-","``","tuple","(","num_embedings",",","embedding_dim",")","``","\uff0c\u5373","embedding","\u7684\u5927\u5c0f\u548c\u6bcf\u4e2a\u8bcd\u7684\u7ef4\u5ea6\uff0c\u6b64\u65f6\u5c06\u968f\u673a\u521d\u59cb\u5316\u4e00\u4e2a",":","class",":","`","torch.nn.Embedding","`","\u5b9e\u4f8b\uff1b","-",":","class",":","`","torch.nn.Embedding","`","\u6216","*","*","fastNLP","*","*","\u7684","``","Embedding","``","\u5bf9\u8c61\uff0c\u6b64\u65f6\u5c31\u4ee5\u4f20\u5165\u7684\u5bf9\u8c61\u4f5c\u4e3a","embedding\uff1b","-",":","class",":","`","numpy.ndarray","`","\uff0c\u5c06\u4f7f\u7528\u4f20\u5165\u7684","ndarray","\u4f5c\u4e3a","Embedding","\u521d\u59cb\u5316\uff1b","-",":","class",":","`","torch.Tensor","`","\uff0c\u6b64\u65f6\u5c06\u4f7f\u7528\u4f20\u5165\u7684\u503c\u4f5c\u4e3a","Embedding","\u521d\u59cb\u5316\uff1b",":","param","hidden_size",":",":","class",":","`","~fastNLP.modules.torch.LSTM","`","\u7684\u9690\u85cf\u5c42\u5927\u5c0f",":","param","num_classes",":","\u6709\u591a\u5c11\u4e2a\u7c7b",":","param","dropout",":",":","class",":","`","~fastNLP.modules.torch.LSTM","`","\u4e2d\u4ee5\u53ca","DropOut","\u5c42\u7684","drop","\u6982\u7387",":","param","id2words",":","tag","id","\u8f6c\u4e3a\u5176","tag","word","\u7684\u8868\u3002\u7528\u4e8e\u5728","CRF","\u89e3\u7801\u65f6\u9632\u6b62\u89e3\u51fa\u975e\u6cd5\u7684\u987a\u5e8f\uff0c\u6bd4\u5982","*","*","'BMES","'","*","*","\u8fd9\u4e2a\u6807\u7b7e\u89c4\u8303\u4e2d\uff0c","``","'S","'","``","\u4e0d\u80fd\u51fa\u73b0\u5728","``","'","B","'","``","\u4e4b\u540e\u3002\u8fd9\u91cc\u4e5f\u652f\u6301\u7c7b\u4f3c\u4e8e","``","'","B-NN","'","``","\uff0c\u5373","``","'-","'","``","\u524d\u4e3a\u6807\u7b7e\u7c7b\u578b\u7684\u6307\u793a\uff0c\u540e\u9762\u4e3a\u5177\u4f53\u7684","tag","\u7684\u60c5\u51b5\u3002\u8fd9\u91cc\u4e0d\u4f46\u4f1a\u4fdd\u8bc1","``","'","B-NN","'","``","\u540e\u9762\u4e0d\u4e3a","``","'S-NN","'","``","\u8fd8\u4f1a\u4fdd\u8bc1","``","'","B-NN","'","``","\u540e\u9762\u4e0d\u4f1a\u51fa\u73b0","``","'M-xx","'","``","\uff08\u4efb\u4f55\u975e","``","'M-NN","'","``","\u548c","``","'","E-NN","'","``","\u7684\u60c5\u51b5\uff09\u3002",":","param","encoding_type",":","\u652f\u6301","``","[","``","BIO","''",",","``","BMES","''",",","``","BEMSO","''","]","``","\uff0c\u53ea\u6709\u5728","``","id2words","``","\u4e0d\u4e3a","``","None","``","\u7684\u60c5\u51b5\u6709\u7528\u3002"]
docstr: :param torch.FloatTensor x: [batch_size, max_len, tag_size]
  :param torch.ByteTensor mask: [batch_size, max_len]
  :return torch.LongTensor, [batch_size, max_len]
docstr_tok: [":","param","torch.FloatTensor","x",":","[","batch_size",",","max_len",",","tag_size","]",":","param","torch.ByteTensor","mask",":","[","batch_size",",","max_len","]",":","return","torch.LongTensor",",","[","batch_size",",","max_len","]"]
code: def _decode(self, x, mask):
      r"""
      :param torch.FloatTensor x: [batch_size, max_len, tag_size]
      :param torch.ByteTensor mask: [batch_size, max_len]
      :return torch.LongTensor, [batch_size, max_len]
      """
      tag_seq, _ = self.Crf.viterbi_decode(x, mask)
      return tag_seq
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from ...core.utils import seq_len_to_mask
  from ...embeddings.torch.utils import get_embeddings
  from ...modules.torch.decoder import ConditionalRandomField
  from ...modules.torch.encoder import LSTM
  from ...modules.torch import decoder, encoder
  from ...modules.torch.decoder.crf import allowed_transitions
label_desc: Use image node_id 2 for calling the AdvSeqLabel obj's underlying member method code with example usage: obj._decode(x, mask) and returns: tag_seq