class_docstr: SwinIR
      A PyTorch impl of : `SwinIR: Image Restoration Using Swin Transformer`, based on Swin Transformer.
  
  Args:
      img_size (int | tuple(int)): Input image size. Default 64
      patch_size (int | tuple(int)): Patch size. Default: 1
      in_chans (int): Number of input image channels. Default: 3
      embed_dim (int): Patch embedding dimension. Default: 96
      depths (tuple(int)): Depth of each Swin Transformer layer.
      num_heads (tuple(int)): Number of attention heads in different layers.
      window_size (int): Window size. Default: 7
      mlp_ratio (float): Ratio of mlp hidden dim to embedding dim. Default: 4
      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. Default: None
      drop_rate (float): Dropout rate. Default: 0
      attn_drop_rate (float): Attention dropout rate. Default: 0
      drop_path_rate (float): Stochastic depth rate. Default: 0.1
      norm_layer (nn.Module): Normalization layer. Default: nn.LayerNorm.
      ape (bool): If True, add absolute position embedding to the patch embedding. Default: False
      patch_norm (bool): If True, add normalization after patch embedding. Default: True
      use_checkpoint (bool): Whether to use checkpointing to save memory. Default: False
      upscale: Upscale factor. 2/3/4/8 for image SR, 1 for denoising and compress artifact reduction
      img_range: Image range. 1. or 255.
      upsampler: The reconstruction reconstruction module. 'pixelshuffle'/'pixelshuffledirect'/'nearest+conv'/None
      resi_connection: The convolutional block before residual connection. '1conv'/'3conv'
class_docstr_tok: ["SwinIR","A","PyTorch","impl","of",":","`","SwinIR",":","Image","Restoration","Using","Swin","Transformer","`",",","based","on","Swin","Transformer",".","Args",":","img_size","(","int","|","tuple","(","int",")",")",":","Input","image","size",".","Default","64","patch_size","(","int","|","tuple","(","int",")",")",":","Patch","size",".","Default",":","1","in_chans","(","int",")",":","Number","of","input","image","channels",".","Default",":","3","embed_dim","(","int",")",":","Patch","embedding","dimension",".","Default",":","96","depths","(","tuple","(","int",")",")",":","Depth","of","each","Swin","Transformer","layer",".","num_heads","(","tuple","(","int",")",")",":","Number","of","attention","heads","in","different","layers",".","window_size","(","int",")",":","Window","size",".","Default",":","7","mlp_ratio","(","float",")",":","Ratio","of","mlp","hidden","dim","to","embedding","dim",".","Default",":","4","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",".","Default",":","None","drop_rate","(","float",")",":","Dropout","rate",".","Default",":","0","attn_drop_rate","(","float",")",":","Attention","dropout","rate",".","Default",":","0","drop_path_rate","(","float",")",":","Stochastic","depth","rate",".","Default",":","0.1","norm_layer","(","nn.Module",")",":","Normalization","layer",".","Default",":","nn.LayerNorm",".","ape","(","bool",")",":","If","True",",","add","absolute","position","embedding","to","the","patch","embedding",".","Default",":","False","patch_norm","(","bool",")",":","If","True",",","add","normalization","after","patch","embedding",".","Default",":","True","use_checkpoint","(","bool",")",":","Whether","to","use","checkpointing","to","save","memory",".","Default",":","False","upscale",":","Upscale","factor",".","2\/3\/4\/8","for","image","SR",",","1","for","denoising","and","compress","artifact","reduction","img_range",":","Image","range",".","1.","or","255.","upsampler",":","The","reconstruction","reconstruction","module",".","'pixelshuffle'\/'pixelshuffledirect'\/'nearest+conv'\/None","resi_connection",":","The","convolutional","block","before","residual","connection",".","'1conv'\/'3conv","'"]
code: def flops(self):
      flops = 0
      H, W = self.patches_resolution
      flops += H * W * 3 * self.embed_dim * 9
      flops += self.patch_embed.flops()
      for layer in self.layers:
          flops += layer.flops()
      flops += H * W * 3 * self.embed_dim * self.embed_dim
      flops += self.upsample.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 8 for calling the SwinIR obj's underlying member method code with example usage: obj.flops() and returns: flops