code: def tiled_inference(img, model):
      # test the image tile by tile
      h, w = img.shape[2:]
      tile = opts.SCUNET_tile
      tile_overlap = opts.SCUNET_tile_overlap
      if tile == 0:
          return model(img)
  
      device = devices.get_device_for("scunet")
      assert (
          tile % 8 == 0
      ), "tile size should be a multiple of window_size"
      sf = 1
  
      stride = tile - tile_overlap
      h_idx_list = list(range(0, h - tile, stride)) + [h - tile]
      w_idx_list = list(range(0, w - tile, stride)) + [w - tile]
      E = torch.zeros(
          1, 3, h * sf, w * sf, dtype=img.dtype, device=device
      )
      W = torch.zeros_like(E, dtype=devices.dtype, device=device)
  
      with tqdm(
          total=len(h_idx_list) * len(w_idx_list), desc="ScuNET tiles"
      ) as pbar:
          for h_idx in h_idx_list:
              for w_idx in w_idx_list:
                  in_patch = img[
                      ..., h_idx : h_idx + tile, w_idx : w_idx + tile
                  ]
  
                  out_patch = model(in_patch)
                  out_patch_mask = torch.ones_like(out_patch)
  
                  E[
                      ...,
                      h_idx * sf : (h_idx + tile) * sf,
                      w_idx * sf : (w_idx + tile) * sf,
                  ].add_(out_patch)
                  W[
                      ...,
                      h_idx * sf : (h_idx + tile) * sf,
                      w_idx * sf : (w_idx + tile) * sf,
                  ].add_(out_patch_mask)
                  pbar.update(1)
      output = E.div_(W)
  
      return output
  
file_path: stable-diffusion-webui/extensions-builtin/ScuNET/scripts/scunet_model.py
imports: import sys
  import PIL.Image
  import numpy
  import torch
  from tqdm import tqdm
  import modules.upscaler
  from modules import devices, modelloader, script_callbacks, errors
  from scunet_model_arch import SCUNet
  from modules.modelloader import load_file_from_url
  from modules.shared import opts
label_desc: Use image node_id 2 for calling the UpscalerScuNET obj's underlying member method code with example usage: obj.tiled_inference(img, model) and returns: output, model