class_docstr: MaxViT block composed of MBConv block, Block Attention, and Grid Attention.
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      downscale (bool, optional): If true spatial downscaling is performed. Default: False
      num_heads (int, optional): Number of attention heads. Default 32
      grid_window_size (Tuple[int, int], optional): Grid/Window size to be utilized. Default (7, 7)
      attn_drop (float, optional): Dropout ratio of attention weight. Default: 0.0
      drop (float, optional): Dropout ratio of output. Default: 0.0
      drop_path (float, optional): Dropout ratio of path. Default: 0.0
      mlp_ratio (float, optional): Ratio of mlp hidden dim to embedding dim. Default: 4.0
      act_layer (Type[nn.Module], optional): Type of activation layer to be utilized. Default: nn.GELU
      norm_layer (Type[nn.Module], optional): Type of normalization layer to be utilized. Default: nn.BatchNorm2d
      norm_layer_transformer (Type[nn.Module], optional): Normalization layer in Transformer. Default: nn.LayerNorm
class_docstr_tok: ["MaxViT","block","composed","of","MBConv","block",",","Block","Attention",",","and","Grid","Attention",".","Args",":","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","downscale","(","bool",",","optional",")",":","If","true","spatial","downscaling","is","performed",".","Default",":","False","num_heads","(","int",",","optional",")",":","Number","of","attention","heads",".","Default","32","grid_window_size","(","Tuple","[","int",",","int","]",",","optional",")",":","Grid\/Window","size","to","be","utilized",".","Default","(","7",",","7",")","attn_drop","(","float",",","optional",")",":","Dropout","ratio","of","attention","weight",".","Default",":","0.0","drop","(","float",",","optional",")",":","Dropout","ratio","of","output",".","Default",":","0.0","drop_path","(","float",",","optional",")",":","Dropout","ratio","of","path",".","Default",":","0.0","mlp_ratio","(","float",",","optional",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","Default",":","4.0","act_layer","(","Type","[","nn.Module","]",",","optional",")",":","Type","of","activation","layer","to","be","utilized",".","Default",":","nn.GELU","norm_layer","(","Type","[","nn.Module","]",",","optional",")",":","Type","of","normalization","layer","to","be","utilized",".","Default",":","nn.BatchNorm2d","norm_layer_transformer","(","Type","[","nn.Module","]",",","optional",")",":","Normalization","layer","in","Transformer",".","Default",":","nn.LayerNorm"]
docstr: Constructor method 
docstr_tok: ["Constructor","method"]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      downscale: bool = False,
      num_heads: int = 32,
      grid_window_size: Tuple[int, int] = (7, 7),
      attn_drop: float = 0.0,
      drop: float = 0.0,
      drop_path: float = 0.0,
      mlp_ratio: float = 4.0,
      act_layer: Type[nn.Module] = nn.GELU,
      norm_layer: Type[nn.Module] = nn.BatchNorm2d,
      norm_layer_transformer: Type[nn.Module] = nn.LayerNorm,
  ) -> None:
      """Constructor method"""
      # Call super constructor
      super().__init__()
      # Init MBConv block
      self.mb_conv = MBConv(
          in_channels=in_channels,
          out_channels=out_channels,
          downscale=downscale,
          act_layer=act_layer,
          norm_layer=norm_layer,
          drop_path=drop_path,
      )
      # Init Block and Grid Transformer
      self.block_transformer = MaxViTTransformerBlock(
          in_channels=out_channels,
          partition_function=window_partition,
          reverse_function=window_reverse,
          num_heads=num_heads,
          grid_window_size=grid_window_size,
          attn_drop=attn_drop,
          drop=drop,
          drop_path=drop_path,
          mlp_ratio=mlp_ratio,
          act_layer=act_layer,
          norm_layer=norm_layer_transformer,
      )
      self.grid_transformer = MaxViTTransformerBlock(
          in_channels=out_channels,
          partition_function=grid_partition,
          reverse_function=grid_reverse,
          num_heads=num_heads,
          grid_window_size=grid_window_size,
          attn_drop=attn_drop,
          drop=drop,
          drop_path=drop_path,
          mlp_ratio=mlp_ratio,
          act_layer=act_layer,
          norm_layer=norm_layer_transformer,
      )
  
file_path: towhee/towhee/models/max_vit/max_vit_block.py
imports: from typing import Tuple, Union, List, Type, Callable
  import torch
  from torch import nn
  from timm.models.layers import Mlp, DropPath
  from towhee.models.layers.relative_self_attention import RelativeSelfAttention
  from towhee.models.layers.mbconv import MBConv
  from towhee.models.max_vit.max_vit_utils import window_reverse, window_partition, grid_reverse, grid_partition
label_desc: Use image node_id 1 to create a new MaxViTBlock object from inherited base classes: nn with example: obj = MaxViTBlock(in_channels, out_channels, downscale, num_heads, grid_window_size, attn_drop, drop, drop_path, mlp_ratio, act_layer, norm_layer, norm_layer_transformer)