code: def pad_divide_by(in_img, d, in_size=None):
      if in_size is None:
          h, w = in_img.shape[-2:]
      else:
          h, w = in_size
  
      if h % d > 0:
          new_h = h + d - h % d
      else:
          new_h = h
      if w % d > 0:
          new_w = w + d - w % d
      else:
          new_w = w
      lh, uh = int((new_h - h) / 2), int(new_h - h) - int(
          (new_h - h) / 2
      )
      lw, uw = int((new_w - w) / 2), int(new_w - w) - int(
          (new_w - w) / 2
      )
      pad_array = (int(lw), int(uw), int(lh), int(uh))
  
      if len(in_img.shape) == 5:
          N, B, C, H, W = in_img.shape
          in_img = in_img.reshape([-1, C, H, W])
          out = F.pad(in_img, pad_array, data_format="NCHW").unsqueeze(
              0
          )
      else:
          out = F.pad(in_img, pad_array, data_format="NCHW")
      return out, pad_array
  
file_path: PaddleSeg/EISeg/eiseg/plugin/video/util/tensor_util.py
imports: import numpy
  import paddle
  import paddle.nn.functional
  from paddle.vision import transforms
label_desc: Use image node_id 9 for calling a global function with example usage: pad_divide_by(in_img, d, in_size) and returns: out,  pad_array