class_docstr: Swin Transformer Block.
  Args:
      dim (int): Number of input channels.
      input_resolution (tuple[int]): Input resulotion.
      num_heads (int): Number of attention heads.
      window_size (int): Window size.
      shift_size (int): Shift size for SW-MSA.
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim.
      qkv_bias (bool, optional): If True, add a learnable bias to query, key, value. Default: True
      qk_scale (float | None, optional): Override default qk scale of head_dim ** -0.5 if set.
      drop (float, optional): Dropout rate. Default: 0.0
      attn_drop (float, optional): Attention dropout rate. Default: 0.0
      drop_path (float, optional): Stochastic depth rate. Default: 0.0
      act_layer (nn.Layer, optional): Activation layer. Default: nn.GELU
      norm_layer (nn.Layer, optional): Normalization layer.  Default: nn.LayerNorm
class_docstr_tok: ["Swin","Transformer","Block",".","Args",":","dim","(","int",")",":","Number","of","input","channels",".","input_resolution","(","tuple","[","int","]",")",":","Input","resulotion",".","num_heads","(","int",")",":","Number","of","attention","heads",".","window_size","(","int",")",":","Window","size",".","shift_size","(","int",")",":","Shift","size","for","SW-MSA",".","mlp_ratio","(","float",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","qkv_bias","(","bool",",","optional",")",":","If","True",",","add","a","learnable","bias","to","query",",","key",",","value",".","Default",":","True","qk_scale","(","float","|","None",",","optional",")",":","Override","default","qk","scale","of","head_dim","*","*","-0.5","if","set",".","drop","(","float",",","optional",")",":","Dropout","rate",".","Default",":","0.0","attn_drop","(","float",",","optional",")",":","Attention","dropout","rate",".","Default",":","0.0","drop_path","(","float",",","optional",")",":","Stochastic","depth","rate",".","Default",":","0.0","act_layer","(","nn.Layer",",","optional",")",":","Activation","layer",".","Default",":","nn.GELU","norm_layer","(","nn.Layer",",","optional",")",":","Normalization","layer",".","Default",":","nn.LayerNorm"]
code: def flops(self):
      flops = 0
      H, W = self.input_resolution
      # norm1
      flops += self.dim * H * W
      # W-MSA/SW-MSA
      nW = H * W / self.window_size / self.window_size
      flops += nW * self.attn.flops(self.window_size * self.window_size)
      # mlp
      flops += 2 * H * W * self.dim * self.dim * self.mlp_ratio
      # norm2
      flops += self.dim * H * W
      return flops
  
imports: import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 5 for calling the SwinTransformerBlock obj's underlying member method code with example usage: obj.flops() and returns: flops