class_docstr: This is much like `.vision_transformer.Block` but:
      - Called TransformerLayer here to allow for "block" as defined in the paper ("non-overlapping image blocks")
      - Uses modified Attention layer that handles the "block" dimension
class_docstr_tok: ["This","is","much","like","`",".vision_transformer.Block","`","but",":","-","Called","TransformerLayer","here","to","allow","for","``","block","''","as","defined","in","the","paper","(","``","non-overlapping","image","blocks","''",")","-","Uses","modified","Attention","layer","that","handles","the","``","block","''","dimension"]
code: def __init__(
      self,
      dim,
      num_heads,
      mlp_ratio=4.0,
      qkv_bias=False,
      proj_drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=nn.LayerNorm,
  ):
      super().__init__()
      self.norm1 = norm_layer(dim)
      self.attn = Attention(
          dim,
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          attn_drop=attn_drop,
          proj_drop=proj_drop,
      )
      self.drop_path = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
      self.norm2 = norm_layer(dim)
      mlp_hidden_dim = int(dim * mlp_ratio)
      self.mlp = Mlp(
          in_features=dim,
          hidden_features=mlp_hidden_dim,
          act_layer=act_layer,
          drop=proj_drop,
      )
  
imports: import collections.abc
  import logging
  import math
  from functools import partial
  import torch
  import torch.nn.functional
  from torch import nn
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import PatchEmbed, Mlp, DropPath, create_classifier, trunc_normal_, _assert
  from timm.layers import create_conv2d, create_pool2d, to_ntuple, use_fused_attn, LayerNorm
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import checkpoint_seq, named_apply
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
label_desc: Use image node_id 1 to create a new TransformerLayer object from inherited base classes: nn with example: obj = TransformerLayer(dim, num_heads, mlp_ratio, qkv_bias, proj_drop, attn_drop, drop_path, act_layer, norm_layer)