class_docstr: 3D Swin Transformer Block.
  
  Args:
      dim (`int`):
          Number of input channels.
      num_heads (`int`):
          Number of attention heads.
      window_size (`tuple[int]`):
          Window size.
      shift_size (`tuple[int]`):
          Shift size for SW-MSA.
      mlp_ratio (`float`):
          Ratio of mlp hidden dim to embedding dim.
      qkv_bias (`bool`):
          If True, add a learnable bias to query, key, value. Default: True
      qk_scale (`float`):
          Override default qk scale of head_dim ** -0.5 if set.
      drop (`float`):
          Dropout rate. Default: 0.0
      attn_drop (`float`):
          Attention dropout rate. Default: 0.0
      drop_path(`float`):
          Stochastic depth rate. Default: 0.0
      act_layer (`nn.Module`):
          Activation layer. Default: nn.GELU
      norm_layer (`nn.Module`):
          Normalization layer.  Default: nn.LayerNorm
code: def __init__(
      self,
      dim,
      num_heads,
      window_size=(2, 7, 7),
      shift_size=(0, 0, 0),
      mlp_ratio=4.0,
      qkv_bias=True,
      qk_scale=None,
      drop=0.0,
      attn_drop=0.0,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=nn.LayerNorm,
      use_checkpoint=False,
  ):
      super().__init__()
      self.dim = dim
      self.num_heads = num_heads
      self.window_size = window_size
      self.shift_size = shift_size
      self.mlp_ratio = mlp_ratio
      self.use_checkpoint = use_checkpoint
  
      assert (
          0 <= self.shift_size[0] < self.window_size[0]
      ), "shift_size must in 0-window_size"
      assert (
          0 <= self.shift_size[1] < self.window_size[1]
      ), "shift_size must in 0-window_size"
      assert (
          0 <= self.shift_size[2] < self.window_size[2]
      ), "shift_size must in 0-window_size"
  
      self.norm1 = norm_layer(dim)
      self.attn = WindowAttention3D(
          dim,
          window_size=self.window_size,
          num_heads=num_heads,
          qkv_bias=qkv_bias,
          qk_scale=qk_scale,
          attn_drop=attn_drop,
          proj_drop=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=drop,
      )
  
file_path: towhee/towhee/models/layers/swin_transformer_block3d.py
imports: import torch
  from torch import nn
  from torch.utils import checkpoint
  import torch.nn.functional
  from towhee.models.layers.window_attention3d import WindowAttention3D
  from towhee.models.utils.window_partition3d import window_partition
  from towhee.models.utils.window_reverse3d import window_reverse
  from towhee.models.layers.mlp import Mlp
  from towhee.models.utils.get_window_size import get_window_size
  from towhee.models.layers.droppath import DropPath
label_desc: Use image node_id 1 to create a new SwinTransformerBlock3D object from inherited base classes: nn with example: obj = SwinTransformerBlock3D(dim, num_heads, window_size, shift_size, mlp_ratio, qkv_bias, qk_scale, drop, attn_drop, drop_path, act_layer, norm_layer, use_checkpoint)