code: def pad_same(
      x: torch.Tensor,
      k: List[int],
      s: List[int],
      d: List[int] = (1, 1),
      value: float = 0,
  ) -> torch.Tensor:
      """
      Dynamically pad input x with 'SAME' padding for conv with specified args
      Args:
          x(`torch.Tensor`):
              Input tensor.
          k(`List[Int]`):
              Convolution kernel sizes.
          s(`List[Int]`):
              Convolution stride parameters.
          d(`List[Int]`):
              Convolution dilation parameter.
          value(`Float`):
              Value for padding.
      Returns:
          (`torch.Tensor`):
              Output Tensor for conv with 'SAME' padding.
      """
      ih, iw = x.size()[-2:]
      pad_h, pad_w = get_same_padding(
          ih, k[0], s[0], d[0]
      ), get_same_padding(iw, k[1], s[1], d[1])
      if pad_h > 0 or pad_w > 0:
          x = F.pad(
              x,
              [
                  pad_w // 2,
                  pad_w - pad_w // 2,
                  pad_h // 2,
                  pad_h - pad_h // 2,
              ],
              value=value,
          )
      return x
  
file_path: towhee/towhee/models/layers/padding_functions.py
imports: import math
  from typing import List, Tuple
  import torch
  from torch import Tensor
  import torch.nn.functional
label_desc: Use image node_id 4 for calling a global function with example usage: pad_same(x, k, s, d, value) and returns: x