class_docstr: :class:`~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder` 对应的 :class:`State`，保存 ``encoder`` 的输出以及 ``LSTM`` 解码过程中的一些中间状态
  
  :param encoder_output: ``encoder`` 的输出，形状为 ``[batch_size, src_seq_len, encode_output_size]``
  :param encoder_mask: 掩码，形状为 ``[batch_size, src_seq_len]``，为 **1** 的地方表示需要 attend
  :param hidden: 上个时刻的 ``hidden`` 状态，形状为 ``[num_layers, batch_size, hidden_size]``
  :param cell: 上个时刻的 ``cell`` 状态，形状为 ``[num_layers, batch_size, hidden_size]``
class_docstr_tok: [":","class",":","`","~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder","`","\u5bf9\u5e94\u7684",":","class",":","`","State","`","\uff0c\u4fdd\u5b58","``","encoder","``","\u7684\u8f93\u51fa\u4ee5\u53ca","``","LSTM","``","\u89e3\u7801\u8fc7\u7a0b\u4e2d\u7684\u4e00\u4e9b\u4e2d\u95f4\u72b6\u6001",":","param","encoder_output",":","``","encoder","``","\u7684\u8f93\u51fa\uff0c\u5f62\u72b6\u4e3a","``","[","batch_size",",","src_seq_len",",","encode_output_size","]","``",":","param","encoder_mask",":","\u63a9\u7801\uff0c\u5f62\u72b6\u4e3a","``","[","batch_size",",","src_seq_len","]","``","\uff0c\u4e3a","*","*","1","*","*","\u7684\u5730\u65b9\u8868\u793a\u9700\u8981","attend",":","param","hidden",":","\u4e0a\u4e2a\u65f6\u523b\u7684","``","hidden","``","\u72b6\u6001\uff0c\u5f62\u72b6\u4e3a","``","[","num_layers",",","batch_size",",","hidden_size","]","``",":","param","cell",":","\u4e0a\u4e2a\u65f6\u523b\u7684","``","cell","``","\u72b6\u6001\uff0c\u5f62\u72b6\u4e3a","``","[","num_layers",",","batch_size",",","hidden_size","]","``"]
docstr: :class:`~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder` 中每个时刻的输入会把上个 token 的 embedding 和 ``input_feed`` 拼接起来输入到下个时刻，在
  :class:`~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder` 不使用 ``attention`` 时，``input_feed`` 即上个时刻的 ``hidden state``，否则是 ``attention layer`` 的输出。
  
  :return: ``[batch_size, hidden_size]``
docstr_tok: [":","class",":","`","~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder","`","\u4e2d\u6bcf\u4e2a\u65f6\u523b\u7684\u8f93\u5165\u4f1a\u628a\u4e0a\u4e2a","token","\u7684","embedding","\u548c","``","input_feed","``","\u62fc\u63a5\u8d77\u6765\u8f93\u5165\u5230\u4e0b\u4e2a\u65f6\u523b\uff0c\u5728",":","class",":","`","~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder","`","\u4e0d\u4f7f\u7528","``","attention","``","\u65f6\uff0c","``","input_feed","``","\u5373\u4e0a\u4e2a\u65f6\u523b\u7684","``","hidden","state","``","\uff0c\u5426\u5219\u662f","``","attention","layer","``","\u7684\u8f93\u51fa\u3002",":","return",":","``","[","batch_size",",","hidden_size","]","``"]
code: def input_feed(self) -> torch.FloatTensor:
      """
      :class:`~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder` 中每个时刻的输入会把上个 token 的 embedding 和 ``input_feed`` 拼接起来输入到下个时刻，在
      :class:`~fastNLP.modules.torch.decoder.LSTMSeq2SeqDecoder` 不使用 ``attention`` 时，``input_feed`` 即上个时刻的 ``hidden state``，否则是 ``attention layer`` 的输出。
  
      :return: ``[batch_size, hidden_size]``
      """
      return self._input_feed
  
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 2 for calling the LSTMState obj's underlying member method code with example usage: obj.input_feed() and returns: self