class_docstr: 所有 **Sequence2Sequence Encoder** 的基类。需要实现 :meth:`forward` 函数
class_docstr_tok: ["\u6240\u6709","*","*","Sequence2Sequence","Encoder","*","*","\u7684\u57fa\u7c7b\u3002\u9700\u8981\u5b9e\u73b0",":","meth",":","`","forward","`","\u51fd\u6570"]
docstr: :param tokens: ``[batch_size, max_len]]``，encoder 的输入
  :param seq_len: ``[batch_size,]``
  :return:
docstr_tok: [":","param","tokens",":","``","[","batch_size",",","max_len","]","]","``","\uff0cencoder","\u7684\u8f93\u5165",":","param","seq_len",":","``","[","batch_size",",","]","``",":","return",":"]
code: def forward(
      self, tokens: torch.LongTensor, seq_len: torch.LongTensor
  ):
      """
  
      :param tokens: ``[batch_size, max_len]]``，encoder 的输入
      :param seq_len: ``[batch_size,]``
      :return:
      """
      raise NotImplementedError
  
imports: import torch.nn
  import torch
  from torch.nn import LayerNorm
  import torch.nn.functional
  from typing import Union, Tuple
  from ....core.utils import seq_len_to_mask
  import math
  from .lstm import LSTM
  from ..attention import MultiHeadAttention
  from ....embeddings.torch import StaticEmbedding
  from ....embeddings.torch.utils import get_embeddings
label_desc: Use image node_id 2 for calling the Seq2SeqEncoder obj's underlying member method code with example usage: obj.forward(tokens, seq_len) without return types