class_docstr: MultiScaleBlock for mvit
class_docstr_tok: ["MultiScaleBlock","for","mvit"]
code: def __init__(
      self,
      dim,
      dim_out,
      num_heads,
      mlp_ratio=4.0,
      qkv_bias=False,
      drop_rate=0.0,
      drop_path=0.0,
      act_layer=GELU,
      norm_layer=LayerNorm,
      up_rate=None,
      kernel_q=(1, 1, 1),
      kernel_kv=(1, 1, 1),
      kernel_skip=(1, 1, 1),
      stride_q=(1, 1, 1),
      stride_kv=(1, 1, 1),
      stride_skip=(1, 1, 1),
      mode="conv",
      has_cls_embed=True,
  ):
      super().__init__()
      self.add1 = Add()
      self.add2 = Add()
      self.clone1 = Clone()
      self.clone2 = Clone()
      self.clone_norm = Clone()
  
      self.dim = dim
      self.dim_out = dim_out
      self.norm1 = norm_layer(dim)
      padding_skip = [int(skip // 2) for skip in kernel_skip]
      self.attn = MultiScaleAttention(
          dim,
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          drop_rate=drop_rate,
          kernel_q=kernel_q,
          kernel_kv=kernel_kv,
          stride_q=stride_q,
          stride_kv=stride_kv,
          norm_layer=LayerNorm,
          has_cls_embed=has_cls_embed,
          mode=mode,
      )
      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.has_cls_embed = has_cls_embed
      if up_rate is not None and up_rate > 1:
          mlp_dim_out = dim * up_rate
      else:
          mlp_dim_out = dim_out
      self.mlp = Mlp(
          in_features=dim,
          hidden_features=mlp_hidden_dim,
          out_features=mlp_dim_out,
          act_layer=act_layer,
          drop_rate=drop_rate,
      )
      if dim != dim_out:
          self.proj = Linear(
              dim, dim_out
          )  # pylint: disable=too-many-function-args
  
      self.pool_skip = (
          MaxPool3d(  # pylint: disable=too-many-function-args,unexpected-keyword-arg
              kernel_skip, stride_skip, padding_skip, ceil_mode=False
          )
          if len(kernel_skip) > 0
          else None
      )
      self.atn_pool = AttentionPool(
          pool=self.pool_skip,
          # thw_shape=thw_shape,
          has_cls_embed=self.has_cls_embed,
      )
  
imports: import math
  from functools import partial
  from typing import Tuple, List
  import numpy
  import torch
  from torch import nn
  from torch.nn.init import trunc_normal_
  from einops import rearrange
  from towhee.models.layers.layers_with_relprop import GELU, Linear, Dropout, Conv2d, Conv3d, Softmax, Sigmoid, LayerNorm, Einsum, Add, Clone, MaxPool3d, IndexSelect
label_desc: Use image node_id 1 to create a new MultiScaleBlock object from inherited base classes: nn with example: obj = MultiScaleBlock(dim, dim_out, num_heads, mlp_ratio, qkv_bias, drop_rate, drop_path, act_layer, norm_layer, up_rate, kernel_q, kernel_kv, kernel_skip, stride_q, stride_kv, stride_skip, mode, has_cls_embed)