class_docstr: A complete encoder-decoder model, with optional attention.
  
  A parent class which makes use of the contextual_embedding (such as a charlm)
  can make use of unsaved_modules when saving.
class_docstr_tok: ["A","complete","encoder-decoder","model",",","with","optional","attention",".","A","parent","class","which","makes","use","of","the","contextual_embedding","(","such","as","a","charlm",")","can","make","use","of","unsaved_modules","when","saving","."]
code: def embed(self, src, src_mask, pos, raw):
      enc_inputs = self.emb_drop(self.embedding(src))
      batch_size = enc_inputs.size(0)
      if self.use_pos:
          assert (
              pos is not None
          ), "Missing POS input for seq2seq lemmatizer."
          pos_inputs = self.pos_drop(self.pos_embedding(pos))
          enc_inputs = torch.cat(
              [pos_inputs.unsqueeze(1), enc_inputs], dim=1
          )
          pos_src_mask = src_mask.new_zeros([batch_size, 1])
          src_mask = torch.cat([pos_src_mask, src_mask], dim=1)
      if raw is not None and self.contextual_embedding is not None:
          raw_inputs = self.contextual_embedding(raw)
          if self.use_pos:
              raw_zeros = raw_inputs.new_zeros(
                  (raw_inputs.shape[0], 1, raw_inputs.shape[2])
              )
              raw_inputs = torch.cat([raw_inputs, raw_zeros], dim=1)
          enc_inputs = torch.cat([enc_inputs, raw_inputs], dim=2)
      src_lens = list(src_mask.data.eq(constant.PAD_ID).long().sum(1))
      return enc_inputs, batch_size, src_lens, src_mask
  
imports: import logging
  import torch
  from torch import nn
  import torch.nn.functional
  import numpy
  import stanza.models.common.seq2seq_constant
  from stanza.models.common import utils
  from stanza.models.common.seq2seq_modules import LSTMAttention
  from stanza.models.common.beam import Beam
label_desc: Use image node_id 7 for calling the Seq2SeqModel obj's underlying member method code with example usage: obj.embed(src, src_mask, pos, raw) and returns: enc_inputs,  batch_size,  src_lens,  src_mask