code: def create_mlp_util(
      dim_in: int,
      dim_out: int,
      mlp_dim: int,
      num_layers: int,
      norm: Callable,  # pyre-ignore[24]
      bias: bool = True,
      xavier_init: bool = True,
  ) -> nn.Module:
      """
      A utility method for creating the MLP that gets attached to the SSL
      bacbone network either in the form of the projector or predictor.
  
      Consists of multiple squences of "Linear -> Norm -> Relu" layers.
  
      Args:
          dim_in (int): Input dimension size to the MLP.
          dim_out (int): Output dimension size of MLP.
          mlp_dim (int):  Dimentions size for the inner layers of MLP.
          num_layers (int): Number of layer in the MLP.
          norm (callabe): Type of normalization to apply between layers.
              Examples include BatchNorm, SyncBatchNorm, etc
          bias (bool): If set true, enables bias for the final layer.
          xavier_init (bool): If set to true, performs Xavier weight
              initialization for all linear layers.
      """
      if num_layers == 1:
          return nn.Linear(dim_in, dim_out)
  
      b = False if norm is not None else bias
      mlp_layers = [nn.Linear(dim_in, mlp_dim, bias=b)]
      mlp_layers[-1].xavier_init = xavier_init
      for i in range(1, num_layers):
          if norm:
              mlp_layers.append(norm(mlp_dim))
          mlp_layers.append(nn.ReLU(inplace=True))
          if i == num_layers - 1:
              d = dim_out
              b = bias
          else:
              d = mlp_dim
          mlp_layers.append(nn.Linear(mlp_dim, d, bias=b))
          mlp_layers[-1].xavier_init = xavier_init
      return nn.Sequential(*mlp_layers)
  
imports: import math
  from typing import Any, Callable, Dict, List, Optional
  import numpy
  import pytorchvideo_trainer.module.distributed_utils
  import torch
  import torch.nn
  import torch.nn.functional
  from hydra.utils import instantiate
  from pytorch_lightning.trainer import Trainer
  from pytorchvideo_trainer.module.video_classification import Batch, BatchKey, EnsembleMethod, VideoClassificationModule
label_desc: Use image node_id 1 for calling a global function with example usage: create_mlp_util(dim_in, dim_out, mlp_dim, num_layers, norm, bias, xavier_init) and returns: nn, nn