docstr: Args: 
      torch.Tensor [batch_size, seq_max_length, input_size], [B, L, H_in] 一般是经过embedding后的值
      x_len: torch.Tensor [L] 已经排好序的句长值
  Returns:
      output: torch.Tensor [B, L, H_out] 序列标注的使用结果
      hn:     torch.Tensor [B, N, H_out] / [B, H_out] 分类的结果，当 last_layer_hn 时只有最后一层结果
docstr_tok: ["Args",":","torch.Tensor","[","batch_size",",","seq_max_length",",","input_size","]",",","[","B",",","L",",","H_in","]","\u4e00\u822c\u662f\u7ecf\u8fc7embedding\u540e\u7684\u503c","x_len",":","torch.Tensor","[","L","]","\u5df2\u7ecf\u6392\u597d\u5e8f\u7684\u53e5\u957f\u503c","Returns",":","output",":","torch.Tensor","[","B",",","L",",","H_out","]","\u5e8f\u5217\u6807\u6ce8\u7684\u4f7f\u7528\u7ed3\u679c","hn",":","torch.Tensor","[","B",",","N",",","H_out","]","\/","[","B",",","H_out","]","\u5206\u7c7b\u7684\u7ed3\u679c\uff0c\u5f53","last_layer_hn","\u65f6\u53ea\u6709\u6700\u540e\u4e00\u5c42\u7ed3\u679c"]
code: def forward(self, x, x_len):
      """
      Args:
          torch.Tensor [batch_size, seq_max_length, input_size], [B, L, H_in] 一般是经过embedding后的值
          x_len: torch.Tensor [L] 已经排好序的句长值
      Returns:
          output: torch.Tensor [B, L, H_out] 序列标注的使用结果
          hn:     torch.Tensor [B, N, H_out] / [B, H_out] 分类的结果，当 last_layer_hn 时只有最后一层结果
      """
      B, L, _ = x.size()
      H, N = self.hidden_size, self.num_layers
  
      x_len = x_len.cpu()
      x = pack_padded_sequence(
          x, x_len, batch_first=True, enforce_sorted=True
      )
      output, hn = self.rnn(x)
      output, _ = pad_packed_sequence(
          output, batch_first=True, total_length=L
      )
  
      if self.type_rnn == "LSTM":
          hn = hn[0]
      if self.bidirectional:
          hn = (
              hn.view(N, 2, B, H)
              .transpose(1, 2)
              .contiguous()
              .view(N, B, 2 * H)
              .transpose(0, 1)
          )
      else:
          hn = hn.transpose(0, 1)
      if self.last_layer_hn:
          hn = hn[:, -1, :]
  
      return output, hn
  
imports: import torch
  import torch.nn
  from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence
label_desc: Use image node_id 2 for calling the RNN obj's underlying member method code with example usage: obj.forward(x, x_len) and returns: output,  hn