class_docstr: MLPMixer.
  
  Implements
  MLP-Mixer: An all-MLP Architecture for Vision
  https://arxiv.org/abs/2105.01601
code: def forward(self, inputs: torch.Tensor) -> torch.Tensor:
      assert inputs.shape[1:] == self.input_shape
      hidden = self.patch_conv(inputs)
      hidden = hidden.flatten(2).transpose(1, 2)
  
      for mixer_block in self.mixer_blocks:
          hidden = mixer_block(hidden)
      hidden = self.layer_norm(hidden)
  
      if self.avg_pool:
          hidden = torch.mean(hidden, dim=1)
  
      assert hidden.shape[1:] == self.output_shape
  
      return hidden
  
imports: from typing import Tuple, Union
  import torch
  import torch.nn
  from ludwig.utils.torch_utils import LudwigModule
label_desc: Use image node_id 2 for calling the MLPMixer obj's underlying member method code with example usage: obj.forward(inputs) and returns: hidden