class_docstr: Multimodal Combination module.
docstr: Forward pass.
  
  :param tensor:
      a [bsz, seq_len, hidden_dim] FloatTensor
  :param mask:
      a [bsz, seq_len] ByteTensor filled with 1 when inside the sequence and 0 outside.
  
  :return:
      output: a [bsz, hidden_dim] FloatTensor of encodings
      mask: the same as before
docstr_tok: ["Forward","pass",".",":","param","tensor",":","a","[","bsz",",","seq_len",",","hidden_dim","]","FloatTensor",":","param","mask",":","a","[","bsz",",","seq_len","]","ByteTensor","filled","with","1","when","inside","the","sequence","and","0","outside",".",":","return",":","output",":","a","[","bsz",",","hidden_dim","]","FloatTensor","of","encodings","mask",":","the","same","as","before"]
code: def forward(self, tensor, mask):
      """
      Forward pass.
  
      :param tensor:
          a [bsz, seq_len, hidden_dim] FloatTensor
      :param mask:
          a [bsz, seq_len] ByteTensor filled with 1 when inside the sequence and 0 outside.
  
      :return:
          output: a [bsz, hidden_dim] FloatTensor of encodings
          mask: the same as before
      """
      seq_len = tensor.size(1)
      positions = tensor.new(seq_len).long()
      positions = torch.arange(seq_len, out=positions).unsqueeze(0)
      tensor = tensor + self.position_embeddings(positions).expand_as(
          tensor
      )
  
      tensor *= mask.unsqueeze(-1).float()
      for i in range(self.n_layers):
          tensor = self.layers[i](tensor, mask)
  
      if self.reduction:
          divisor = (
              mask.float().sum(dim=1).unsqueeze(-1).clamp(min=1e-20)
          )
          output = tensor.sum(dim=1) / divisor
          return output
      else:
          output = tensor
          return output, mask
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  import torch
  from torch import nn
  from parlai.utils.io import PathManager
  from parlai.agents.transformer.modules import TransformerEncoder, create_position_codes, TransformerEncoderLayer
  from projects.personality_captions.transresnet.modules import TransresnetModel, load_fasttext_embeddings
label_desc: Use image node_id 2 for calling the MultimodalCombiner obj's underlying member method code with example usage: obj.forward(tensor, mask) and returns: output, output,  mask