code: def infer_params(state_dict):
      # this code is copied from https://github.com/victorca25/iNNfer
      scale2x = 0
      scalemin = 6
      n_uplayer = 0
      plus = False
  
      for block in list(state_dict):
          parts = block.split(".")
          n_parts = len(parts)
          if n_parts == 5 and parts[2] == "sub":
              nb = int(parts[3])
          elif n_parts == 3:
              part_num = int(parts[1])
              if (
                  part_num > scalemin
                  and parts[0] == "model"
                  and parts[2] == "weight"
              ):
                  scale2x += 1
              if part_num > n_uplayer:
                  n_uplayer = part_num
                  out_nc = state_dict[block].shape[0]
          if not plus and "conv1x1" in block:
              plus = True
  
      nf = state_dict["model.0.weight"].shape[0]
      in_nc = state_dict["model.0.weight"].shape[1]
      out_nc = out_nc
      scale = 2**scale2x
  
      return in_nc, out_nc, nf, nb, plus, scale
  
file_path: stable-diffusion-webui/modules/esrgan_model.py
imports: import sys
  import numpy
  import torch
  from PIL import Image
  import modules.esrgan_model_arch
  from modules import modelloader, images, devices
  from modules.shared import opts
  from modules.upscaler import Upscaler, UpscalerData
label_desc: Use image node_id 3 for calling a global function with example usage: infer_params(state_dict) and returns: in_nc,  out_nc,  nf,  nb,  plus,  scale