code: def compute_padding(
      original_size: Union[int, Tuple[int, int]],
      window_size: Union[int, Tuple[int, int]],
  ) -> Tuple[int, int]:
      r"""Compute required padding to ensure chaining of :func:`extract_tensor_patches` and
      :func:`combine_tensor_patches` produces expected result.
  
      Args:
          original_size: the size of the original tensor.
          window_size: the size of the sliding window used while extracting patches.
  
      Return:
          The required padding for `(vertical, horizontal)` as a tuple of 2 ints.
  
      Example:
          >>> image = torch.arange(12).view(1, 1, 4, 3)
          >>> padding = compute_padding((4,3), (3,3))
          >>> out = extract_tensor_patches(image, window_size=(3, 3), stride=(3, 3), padding=padding)
          >>> combine_tensor_patches(out, original_size=(4, 3), window_size=(3, 3), stride=(3, 3), unpadding=padding)
          tensor([[[[ 0,  1,  2],
                    [ 3,  4,  5],
                    [ 6,  7,  8],
                    [ 9, 10, 11]]]])
  
      .. note::
          This function is supposed to be used in conjunction with :func:`extract_tensor_patches`
          and :func:`combine_tensor_patches`.
      """
      original_size = cast(Tuple[int, int], _pair(original_size))
      window_size = cast(Tuple[int, int], _pair(window_size))
  
      if original_size[0] % window_size[0] != 0:
          padh = math.ceil(
              (window_size[0] - original_size[0] % window_size[0]) / 2
          )
      else:
          padh = 0
      if original_size[1] % window_size[1] != 0:
          padw = math.ceil(
              (window_size[1] - original_size[1] % window_size[1]) / 2
          )
      else:
          padw = 0
  
      return (padh, padw)
  
file_path: kornia/kornia/contrib/extract_patches.py
imports: import math
  from typing import Optional, Tuple, Union, cast
  import torch
  import torch.nn.functional
  from torch.nn.modules.utils import _pair
  from kornia.core import Module, Tensor, pad
label_desc: Use image node_id 1 for calling a global function with example usage: compute_padding(original_size, window_size) and returns: padh,  padw