code: def compute_padding_2d(
      pad_type,
      in_height,
      in_width,
      stride_height,
      stride_width,
      filt_height,
      filt_width,
  ):
      """Computes the amount of padding required on each side of the 2D input tensor.
  
      In case of ``same`` padding, this routine tries to pad evenly left and right (top and bottom), but if the amount of
      columns to be added is odd, it will add the extra column to the right/bottom.
  
      Args:
          pad_type (str): Padding type, one of ``same`` or ``valid`` (case insensitive).
          in_height (int): The height of the input tensor.
          in_width (int): The width of the input tensor.
          stride_height (int): Stride height.
          stride_width (int): Stride width.
          filt_height (int): Height of the kernel window.
          filt_width (int): Width of the kernel window.
  
      Raises:
          Exception: Raised if the padding type is unknown.
  
      Returns:
          tuple: Tuple containing the padded input height, width, and top, bottom, left and right padding values.
      """
      if pad_type.lower() == "same":
          # Height
          out_height = int(
              math.ceil(float(in_height) / float(stride_height))
          )
          if in_height % stride_height == 0:
              pad_along_height = max(filt_height - stride_height, 0)
          else:
              pad_along_height = max(
                  filt_height - (in_height % stride_height), 0
              )
          pad_top = pad_along_height // 2
          pad_bottom = pad_along_height - pad_top
          # Width
          out_width = int(
              math.ceil(float(in_width) / float(stride_width))
          )
          if in_width % stride_width == 0:
              pad_along_width = max(filt_width - stride_width, 0)
          else:
              pad_along_width = max(
                  filt_width - (in_width % stride_width), 0
              )
          pad_left = pad_along_width // 2
          pad_right = pad_along_width - pad_left
      elif pad_type.lower() == "valid":
          out_height = int(
              math.ceil(
                  float(in_height - filt_height + 1)
                  / float(stride_height)
              )
          )
          out_width = int(
              math.ceil(
                  float(in_width - filt_width + 1) / float(stride_width)
              )
          )
  
          pad_top = 0
          pad_bottom = 0
          pad_left = 0
          pad_right = 0
      else:
          raise Exception(f"Unknown padding type: {pad_type}")
  
      return (
          out_height,
          out_width,
          pad_top,
          pad_bottom,
          pad_left,
          pad_right,
      )
  
imports: import math
label_desc: Use image node_id 3 for calling a global function with example usage: compute_padding_2d(pad_type, in_height, in_width, stride_height, stride_width, filt_height, filt_width) and returns: out_height,  out_width,  pad_top,  pad_bottom,  pad_left,  pad_right