class_docstr: TinyViT Block.
  
  Args:
      dim (int): Number of input channels.
      input_resolution (tuple[int, int]): Input resolution.
      num_heads (int): Number of attention heads.
      window_size (int): Window size.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
      drop (float, optional): Dropout rate. Default: 0.0
      drop_path (float, optional): Stochastic depth rate. Default: 0.0
      local_conv_size (int): the kernel size of the convolution between
                             Attention and MLP. Default: 3
      activation: the activation function. Default: nn.GELU
class_docstr_tok: ["TinyViT","Block",".","Args",":","dim","(","int",")",":","Number","of","input","channels",".","input_resolution","(","tuple","[","int",",","int","]",")",":","Input","resolution",".","num_heads","(","int",")",":","Number","of","attention","heads",".","window_size","(","int",")",":","Window","size",".","mlp_ratio","(","float",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","drop","(","float",",","optional",")",":","Dropout","rate",".","Default",":","0.0","drop_path","(","float",",","optional",")",":","Stochastic","depth","rate",".","Default",":","0.0","local_conv_size","(","int",")",":","the","kernel","size","of","the","convolution","between","Attention","and","MLP",".","Default",":","3","activation",":","the","activation","function",".","Default",":","nn.GELU"]
code: def __init__(
      self,
      dim,
      input_resolution,
      num_heads,
      window_size=7,
      mlp_ratio=4.0,
      drop=0.0,
      drop_path=0.0,
      local_conv_size=3,
      activation=nn.GELU,
  ):
      super().__init__()
      self.dim = dim
      self.input_resolution = input_resolution
      self.num_heads = num_heads
      assert window_size > 0, "window_size must be greater than 0"
      self.window_size = window_size
      self.mlp_ratio = mlp_ratio
  
      # self.drop_path = DropPath(
      #     drop_path) if drop_path > 0. else nn.Identity()
  
      assert dim % num_heads == 0, "dim must be divisible by num_heads"
      head_dim = dim // num_heads
  
      window_resolution = (window_size, window_size)
      self.attn = Attention(
          dim,
          head_dim,
          num_heads,
          attn_ratio=1,
          resolution=window_resolution,
      )
  
      mlp_hidden_dim = int(dim * mlp_ratio)
      mlp_activation = activation
      self.mlp = Mlp(
          in_features=dim,
          hidden_features=mlp_hidden_dim,
          act_layer=mlp_activation,
          drop=drop,
      )
  
      pad = local_conv_size // 2
      self.local_conv = Conv2d_BN(
          dim, dim, ks=local_conv_size, stride=1, pad=pad, groups=dim
      )
  
imports: import itertools
  import paddle
  from paddle import nn
  from paddle.nn import functional
  from .common import LayerNorm2d
label_desc: Use image node_id 1 to create a new TinyViTBlock object from inherited base classes: nn with example: obj = TinyViTBlock(dim, input_resolution, num_heads, window_size, mlp_ratio, drop, drop_path, local_conv_size, activation)