code: def __init__(self, config: Config, *args, **kwargs):
      super().__init__(config, *args, **kwargs)
  
      self.num_labels = self.config.num_labels
      self.hidden_size = self.config.hidden_size
      self.in_dim = self.config.in_dim = (
          self.hidden_size
          if self.config.in_dim is None
          else self.config.in_dim
      )
  
      # Head modules
      # get_pooler expects hidden_size to be input dim size
      pooler_config = OmegaConf.create(
          dict(self.config, hidden_size=self.in_dim)
      )
      pooler_cls = self.get_pooler(self.config.pooler_name)
      self.pooler = pooler_cls(pooler_config)
  
      num_layers = config.get("num_layers", 1)
      assert num_layers >= 0
  
      layers = []
      prediction_head_config = copy.deepcopy(self.config)
      for _ in range(num_layers):
          layers.append(nn.Dropout(self.config.hidden_dropout_prob))
          layers.append(
              PredictionHeadTransformWithInDim(prediction_head_config)
          )
          with open_dict(prediction_head_config):
              prediction_head_config.in_dim = (
                  prediction_head_config.hidden_size
              )
  
      self.classifier = nn.Sequential(
          *layers, nn.Linear(self.hidden_size, self.num_labels)
      )
  
file_path: mmf/mmf/models/transformers/heads/mlp.py
imports: import copy
  from dataclasses import dataclass
  from typing import Dict, List, Optional
  import torch
  from mmf.common.registry import registry
  from mmf.models.transformers.base import BaseTransformerHead
  from mmf.modules import layers
  from omegaconf import OmegaConf, open_dict
  from torch import nn
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: BaseTransformerHead with example: obj = MLP(config)