class_docstr: MLP model using ReLU. Useful for testing on CPUs.
code: def __init__(
      self,
      input_dim,
      output_dim,
      hidden_dims,
      dropout,
      first_dropout,
      use_batchnorm,
      first_batchnorm,
  ):
      super().__init__()
  
      layers = []
      # If first_batchnorm is set, must be using batchnorm
      assert not first_batchnorm or use_batchnorm
  
      self._num_inputs = input_dim
      self._num_classes = output_dim
      self._model_depth = len(hidden_dims) + 1
  
      if dropout > 0 and first_dropout:
          layers.append(nn.Dropout(p=dropout))
  
      if use_batchnorm and first_batchnorm:
          layers.append(nn.BatchNorm1d(input_dim))
  
      for dim in hidden_dims:
          layers.append(nn.Linear(input_dim, dim))
          if use_batchnorm:
              layers.append(nn.BatchNorm1d(dim))
          if dropout > 0:
              layers.append(nn.Dropout(p=dropout))
          layers.append(nn.ReLU(inplace=True))
          input_dim = dim
  
      layers.append(nn.Linear(input_dim, output_dim))
      self.mlp = nn.Sequential(*layers)
  
file_path: ClassyVision/classy_vision/models/mlp.py
imports: from typing import Any, Dict
  import torch.nn
  from .None import register_model
  from .classy_model import ClassyModel
label_desc: Use image node_id 1 to create a new MLP object from inherited base classes: ClassyModel with example: obj = MLP(input_dim, output_dim, hidden_dims, dropout, first_dropout, use_batchnorm, first_batchnorm)