class_docstr: Tile Image into (non)overlapping Patches. Images are tiled in order to efficiently process large images.
  
  Args:
      tile_size: Tile dimension for each patch
      stride: Stride length between patches
      remove_border_count: Number of border pixels to be removed from tile before untiling
      mode: Upscaling mode for image resize.Supported formats: padding, interpolation
  
  Examples:
      >>> import torch
      >>> from torchvision import transforms
      >>> from skimage.data import camera
      >>> tiler = Tiler(tile_size=256,stride=128)
      >>> image = transforms.ToTensor()(camera())
      >>> tiles = tiler.tile(image)
      >>> image.shape, tiles.shape
      (torch.Size([3, 512, 512]), torch.Size([9, 3, 256, 256]))
  
      >>> # Perform your operations on the tiles.
  
      >>> # Untile the patches to reconstruct the image
      >>> reconstructed_image = tiler.untile(tiles)
      >>> reconstructed_image.shape
      torch.Size([1, 3, 512, 512])
code: def __init__(
      self,
      tile_size: int | Sequence,
      stride: int | Sequence | None = None,
      remove_border_count: int = 0,
      mode: ImageUpscaleMode = ImageUpscaleMode.PADDING,
  ) -> None:
      self.tile_size_h, self.tile_size_w = self.__validate_size_type(
          tile_size
      )
      self.random_tile_count = 4
  
      if stride is not None:
          self.stride_h, self.stride_w = self.__validate_size_type(
              stride
          )
  
      self.remove_border_count = remove_border_count
      self.overlapping = not (
          self.stride_h == self.tile_size_h
          and self.stride_w == self.tile_size_w
      )
      self.mode = mode
  
      if (
          self.stride_h > self.tile_size_h
          or self.stride_w > self.tile_size_w
      ):
          raise StrideSizeError(
              "Larger stride size than kernel size produces unreliable tiling results. "
              "Please ensure stride size is less than or equal than tiling size."
          )
  
      if self.mode not in (
          ImageUpscaleMode.PADDING,
          ImageUpscaleMode.INTERPOLATION,
      ):
          raise ValueError(
              f"Unknown tiling mode {self.mode}. Available modes are padding and interpolation"
          )
  
      self.batch_size: int
      self.num_channels: int
  
      self.input_h: int
      self.input_w: int
  
      self.pad_h: int
      self.pad_w: int
  
      self.resized_h: int
      self.resized_w: int
  
      self.num_patches_h: int
      self.num_patches_w: int
  
imports: from __future__ import annotations
  from enum import Enum
  from itertools import product
  from math import ceil
  from typing import Sequence
  import torch
  import torchvision.transforms
  from torch import Tensor
  from torch.nn import functional
label_desc: Use image node_id 1 to create a new Tiler object  with example: obj = Tiler(tile_size, stride, remove_border_count, mode)