class_docstr: 与 :class:`~fastNLP.modules.torch.decoder.TransformerSeq2SeqDecoder` 对应的 :class:`State`。
  
  :param encoder_output: ``encoder`` 的输出，形状为 ``[batch_size, encode_max_len, encode_output_size]``，
  :param encoder_mask: 掩码，形状为 ``[batch_size, encode_max_len]``，为 **1** 的地方表示需要 attend
  :param num_decoder_layer: decoder 层数
class_docstr_tok: ["\u4e0e",":","class",":","`","~fastNLP.modules.torch.decoder.TransformerSeq2SeqDecoder","`","\u5bf9\u5e94\u7684",":","class",":","`","State","`","\u3002",":","param","encoder_output",":","``","encoder","``","\u7684\u8f93\u51fa\uff0c\u5f62\u72b6\u4e3a","``","[","batch_size",",","encode_max_len",",","encode_output_size","]","``","\uff0c",":","param","encoder_mask",":","\u63a9\u7801\uff0c\u5f62\u72b6\u4e3a","``","[","batch_size",",","encode_max_len","]","``","\uff0c\u4e3a","*","*","1","*","*","\u7684\u5730\u65b9\u8868\u793a\u9700\u8981","attend",":","param","num_decoder_layer",":","decoder","\u5c42\u6570"]
code: def decode_length(self):
      if self.decoder_prev_key[0] is not None:
          return self.decoder_prev_key[0].size(1)
      return 0
  
file_path: fastNLP/fastNLP/modules/torch/decoder/seq2seq_state.py
imports: from typing import Union, List, Tuple
  import torch
label_desc: Use image node_id 3 for calling the TransformerState obj's underlying member method code with example usage: obj.decode_length() and returns: int, self