class_docstr: Keyword-MLP.
class_docstr_tok: ["Keyword-MLP","."]
code: def __init__(
      self,
      input_res=[40, 98],
      patch_res=[40, 1],
      num_classes=35,
      dim=64,
      depth=12,
      ff_mult=4,
      channels=1,
      prob_survival=0.9,
      pre_norm=False,
      **kwargs,
  ):
      super().__init__()
      image_height, image_width = input_res
      patch_height, patch_width = patch_res
      assert (image_height % patch_height) == 0 and (
          image_width % patch_width
      ) == 0, "image height and width must be divisible by patch size"
      num_patches = (image_height // patch_height) * (
          image_width // patch_width
      )
  
      P_Norm = PreNorm if pre_norm else PostNorm
  
      dim_ff = dim * ff_mult
  
      self.to_patch_embed = nn.Sequential(
          Rearrange(),
          nn.Linear(channels * patch_height * patch_width, dim),
      )
  
      self.prob_survival = prob_survival
  
      self.layers = nn.LayerList(
          [
              Residual(
                  P_Norm(
                      dim,
                      gMLPBlock(
                          dim=dim, dim_ff=dim_ff, seq_len=num_patches
                      ),
                  )
              )
              for i in range(depth)
          ]
      )
  
      self.to_logits = nn.Sequential(
          nn.LayerNorm(dim), Reduce(axis=1), nn.Linear(dim, num_classes)
      )
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 1 to create a new KW_MLP object from inherited base classes: nn with example: obj = KW_MLP(input_res, patch_res, num_classes, dim, depth, ff_mult, channels, prob_survival, pre_norm)