class_docstr: Use Transformer to fuse different models' features (single-modal and multimodal).
  Specifically, it adapts the features of each model to specified dimensions,
  concatenates the adapted features, and fuses the features through Transformer.
class_docstr_tok: ["Use","Transformer","to","fuse","different","models","'","features","(","single-modal","and","multimodal",")",".","Specifically",",","it","adapts","the","features","of","each","model","to","specified","dimensions",",","concatenates","the","adapted","features",",","and","fuses","the","features","through","Transformer","."]
code: def forward(
      self,
      batch: dict,
  ):
      multimodal_features = []
      output = {}
      for per_model, per_adapter in zip(self.model, self.adapter):
          per_output = run_model(per_model, batch)
          multimodal_feature = per_adapter(
              per_output[per_model.prefix][FEATURES]
          )
          if multimodal_feature.ndim == 2:
              multimodal_feature = torch.unsqueeze(
                  multimodal_feature, dim=1
              )
          multimodal_features.append(multimodal_feature)
  
          if self.loss_weight is not None:
              per_output[per_model.prefix].update(
                  {
                      WEIGHT: torch.tensor(self.loss_weight).to(
                          multimodal_features[0]
                      )
                  }
              )
              output.update(per_output)
  
      multimodal_features = torch.cat(multimodal_features, dim=1)
      multimodal_features = self.cls_token(multimodal_features)
      features = self.fusion_transformer(multimodal_features)
  
      logits = self.head(features)
      fusion_output = {
          self.prefix: {
              LOGITS: logits,
              FEATURES: features,
          }
      }
      if self.loss_weight is not None:
          fusion_output[self.prefix].update(
              {WEIGHT: torch.tensor(1.0).to(logits)}
          )
          output.update(fusion_output)
          return output
      else:
          return fusion_output
  
file_path: autogluon/multimodal/src/autogluon/multimodal/models/fusion/fusion_transformer.py
imports: import logging
  from typing import Optional
  import torch
  from torch import nn
  from ...constants import AUTOMM, FEATURES, LABEL, LOGITS, WEIGHT
  from ..custom_transformer import CLSToken, Custom_Transformer
  from ..utils import init_weights, run_model
  from .base import AbstractMultimodalFusionModel
label_desc: Use image node_id 3 for calling the MultimodalFusionTransformer obj's underlying member method code with example usage: obj.forward(batch) and returns: output, fusion_output