class_docstr: Implements a 'tri-tower' MLPDecoder: one for left, one for middle, and one for right
class_docstr_tok: ["Implements","a","'tri-tower","'","MLPDecoder",":","one","for","left",",","one","for","middle",",","and","one","for","right"]
code: def forward(self, *x: List[torch.Tensor]) -> torch.Tensor:
      # as per TriTowerClassificationModel's arrange_model_inputs()
      # x[0]: right_text_emb, x[1]: middle_text_emb, x[2]: left_text_emb, x[3]: right_dense, x[4]: middle_dense, x[5]: left_dense
      assert len(x) == 6
  
      if (
          self.export_type == ExportType.RIGHT
          or self.export_type == ExportType.NONE
      ):
          right_tensor = (
              torch.cat((x[0], x[3]), 1).half()
              if precision.FP16_ENABLED
              else torch.cat((x[0], x[3]), 1).float()
          )
          # len(right_tensor[0]) == right_encoder.embedding_dim + right_dense_dim
          right_output = self.mlp_for_right(right_tensor)
          if self.export_type == ExportType.RIGHT:
              return right_output
      if (
          self.export_type == ExportType.MIDDLE
          or self.export_type == ExportType.NONE
      ):
          middle_tensor = (
              torch.cat((x[1], x[4]), 1).half()
              if precision.FP16_ENABLED
              else torch.cat((x[1], x[4]), 1).float()
          )
          # len(middle_tensor[0]) == middle_encoder.embedding_dim + middle_dense_dim
          middle_output = self.mlp_for_middle(middle_tensor)
          if self.export_type == ExportType.MIDDLE:
              return middle_output
  
      if (
          self.export_type == ExportType.LEFT
          or self.export_type == ExportType.NONE
      ):
          left_tensor = (
              torch.cat((x[2], x[5]), 1).half()
              if precision.FP16_ENABLED
              else torch.cat((x[2], x[5]), 1).float()
          )
          # len(left_tensor[0]) == left_encoder.embedding_dim + left_dense_dim
          left_output = self.mlp_for_left(left_tensor)
          if self.export_type == ExportType.LEFT:
              return left_output
  
      return self.mlp(
          torch.cat((right_output, middle_output, left_output), 1)
      )
  
file_path: pytext/pytext/models/decoders/mlp_decoder_tri_tower.py
imports: from enum import Enum
  from typing import List
  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.usage import log_class_usage
label_desc: Use image node_id 3 for calling the MLPDecoderTriTower obj's underlying member method code with example usage: obj.forward() and returns: self, right_output, middle_output, left_output