class_docstr: A basic Swin Transformer layer for one stage.
  
  Args:
      dim (int): Number of input channels.
      input_resolution (tuple[int]): Input resolution.
      depth (int): Number of blocks.
      num_heads (int): Number of attention heads.
      window_size (int): Local window size.
      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 | tuple[float], optional): Stochastic depth rate. Default: 0.0
      norm_layer (nn.Module, optional): Normalization layer. Default: nn.LayerNorm
      downsample (nn.Module | None, optional): Downsample layer at the end of the layer. Default: None
      use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False.
class_docstr_tok: ["A","basic","Swin","Transformer","layer","for","one","stage",".","Args",":","dim","(","int",")",":","Number","of","input","channels",".","input_resolution","(","tuple","[","int","]",")",":","Input","resolution",".","depth","(","int",")",":","Number","of","blocks",".","num_heads","(","int",")",":","Number","of","attention","heads",".","window_size","(","int",")",":","Local","window","size",".","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","|","tuple","[","float","]",",","optional",")",":","Stochastic","depth","rate",".","Default",":","0.0","norm_layer","(","nn.Module",",","optional",")",":","Normalization","layer",".","Default",":","nn.LayerNorm","downsample","(","nn.Module","|","None",",","optional",")",":","Downsample","layer","at","the","end","of","the","layer",".","Default",":","None","use_checkpoint","(","bool",")",":","Whether","to","use","checkpointing","to","save","memory",".","Default",":","False","."]
code: def flops(self):
      flops = 0
      for blk in self.blocks:
          flops += blk.flops()
      if self.downsample is not None:
          flops += self.downsample.flops()
      return flops
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from timm.models.layers import DropPath, to_2tuple, trunc_normal_
label_desc: Use image node_id 4 for calling the BasicLayer obj's underlying member method code with example usage: obj.flops() and returns: flops