class_docstr: Implements a 'two-tower' MLPDecoder: one for left and one for right
class_docstr_tok: ["Implements","a","'two-tower","'","MLPDecoder",":","one","for","left","and","one","for","right"]
code: def forward(self, *x: List[torch.Tensor]) -> torch.Tensor:
      # x[0]: right_text_emb, x[1]: left_text_emb, x[2]: right_dense, x[3]: left_dense
  
      if self.concat_dense:
          assert len(x) == 5
      else:
          assert len(x) == 4
  
      if (
          self.export_type == ExportType.RIGHT
          or self.export_type == ExportType.NONE
      ):
          right_tensor = (
              torch.cat((x[0], x[2]), 1).half()
              if precision.FP16_ENABLED
              else torch.cat((x[0], x[2]), 1).float()
          )
          right_output = self.mlp_for_right(right_tensor)
          if self.export_type == ExportType.RIGHT:
              return right_output
  
      if (
          self.export_type == ExportType.LEFT
          or self.export_type == ExportType.NONE
      ):
          left_tensor = (
              torch.cat((x[1], x[3]), 1).half()
              if precision.FP16_ENABLED
              else torch.cat((x[1], x[3]), 1).float()
          )
          left_output = self.mlp_for_left(left_tensor)
          if self.export_type == ExportType.LEFT:
              return left_output
  
      if not self.concat_dense:
          return self.mlp(torch.cat((right_output, left_output), 1))
      else:
          if self.export_type == ExportType.NONE:
              dense_tensor = (
                  x[4].half()
                  if precision.FP16_ENABLED
                  else x[4].float()
              )
          else:
              dense_tensor = x[4]
  
          dense = self.mlp_for_dense(dense_tensor)
          return self.mlp(
              torch.cat((right_output, left_output, dense), 1)
          )
  
file_path: pytext/pytext/models/decoders/mlp_decoder_two_tower.py
imports: from enum import Enum
  from typing import List, Optional
  import torch
  import torch.nn
  from pytext.config.module_config import Activation
  from pytext.models.decoders.decoder_base import DecoderBase
  from pytext.optimizer import get_activation
  from pytext.utils import precision
  from pytext.utils.file_io import PathManager
  from pytext.utils.usage import log_class_usage
  from torch.serialization import default_restore_location
label_desc: Use image node_id 3 for calling the MLPDecoderTwoTower obj's underlying member method code with example usage: obj.forward() and returns: self, self, right_output, left_output