code: def compute_padding_1d(pad_type, in_size, stride, filt_size):
      """Computes the amount of padding required on each side of the 1D input tensor.
  
      In case of ``same`` padding, this routine tries to pad evenly left and right, but if the amount of columns to be added
      is odd, it will add the extra column to the right.
  
      Args:
          pad_type (str): Padding type, one of ``same``, `valid`` or ``causal`` (case insensitive).
          in_size (int): Input size.
          stride (int): Stride length.
          filt_size (int): Length of the kernel window.
  
      Raises:
          Exception: Raised if the padding type is unknown.
  
      Returns:
          tuple: Tuple containing the padded input size, left and right padding values.
      """
      if pad_type.lower() == "same":
          n_out = int(math.ceil(float(in_size) / float(stride)))
          if in_size % stride == 0:
              pad_along_size = max(filt_size - stride, 0)
          else:
              pad_along_size = max(filt_size - (in_size % stride), 0)
          pad_left = pad_along_size // 2
          pad_right = pad_along_size - pad_left
      elif pad_type.lower() == "valid":
          n_out = int(
              math.ceil(float(in_size - filt_size + 1) / float(stride))
          )
          pad_left = 0
          pad_right = 0
      elif pad_type.lower() == "causal":
          n_out = int(math.ceil(float(in_size) / float(stride)))
          if in_size % stride == 0:
              pad_along_size = max(filt_size - stride, 0)
          else:
              pad_along_size = max(filt_size - (in_size % stride), 0)
          pad_left = pad_along_size
          pad_right = 0
      else:
          raise Exception(f"Unknown padding type: {pad_type}")
  
      return (n_out, pad_left, pad_right)
  
imports: import math
label_desc: Use image node_id 2 for calling a global function with example usage: compute_padding_1d(pad_type, in_size, stride, filt_size) and returns: n_out,  pad_left,  pad_right