class_docstr: MLP as used in Vision Transformer, MLP-Mixer and related networks
class_docstr_tok: ["MLP","as","used","in","Vision","Transformer",",","MLP-Mixer","and","related","networks"]
code: def __init__(self, config: MgpstrConfig, hidden_features):
      super().__init__()
      hidden_features = hidden_features or config.hidden_size
      self.fc1 = nn.Linear(config.hidden_size, hidden_features)
      self.act = nn.GELU()
      self.fc2 = nn.Linear(hidden_features, config.hidden_size)
      self.drop = nn.Dropout(config.drop_rate)
  
imports: import collections.abc
  from dataclasses import dataclass
  from typing import Optional, Tuple, Union
  import torch
  import torch.nn.functional
  import torch.utils.checkpoint
  from torch import nn
  from ...modeling_outputs import BaseModelOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import ModelOutput, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_mgp_str import MgpstrConfig
label_desc: Use image node_id 1 to create a new MgpstrMlp object from inherited base classes: nn with example: obj = MgpstrMlp(config, hidden_features)