code: def divisible_pad_t(
      x: Tensor, k: int = 16
  ) -> tuple[
      Tensor,
      tuple[
          tuple[int, int],
          tuple[int, int],
          tuple[int, int],
          int,
          int,
          int,
      ],
  ]:
      """
      Pad input to feed into the network (torch script compatible)
  
      Args:
          x: input of shape (B,C,H,W) for 2D data or (B,C,H,W,D) for 3D data
          k: padding factor. each padded dimension will be divisible by k.
  
      Returns:
          A tuple containing
              (1) padded input
              (2) pad sizes (in order to reverse padding if needed)
  
      Example:
          .. code-block:: python
  
              import torch
  
              # 2D data
              x = torch.ones([3,2,50,70])
              x_pad,padding_sizes = divisible_pad_t(x, k=16)
              # the following line should print (3, 2, 64, 80)
              print(x_pad.shape)
  
              # 3D data
              x = torch.ones([3,2,50,70,80])
              x_pad,padding_sizes = divisible_pad_t(x, k=16)
              # the following line should print (3, 2, 64, 80, 80)
              print(x_pad.shape)
  
      """
      if len(x.shape) == 4:  # this is 2D
          b, c, h, w = x.shape
          w_mult = (
              (w - 1) | (k - 1)
          ) + 1  # OR with (k-1) and then +1 makes sure padding is divisible by k
          h_mult = ((h - 1) | (k - 1)) + 1
          w_pad = floor_ceil((w_mult - w) / 2)
          h_pad = floor_ceil((h_mult - h) / 2)
          x = F.pad(x, w_pad + h_pad)
          # dummy values for the 3rd spatial dimension
          d_mult = -1
          d_pad = (-1, -1)
          pad_sizes = (h_pad, w_pad, d_pad, h_mult, w_mult, d_mult)
  
      elif len(x.shape) == 5:  # this is 3D
          b, c, h, w, d = x.shape
          w_mult = ((w - 1) | (k - 1)) + 1
          h_mult = ((h - 1) | (k - 1)) + 1
          d_mult = ((d - 1) | (k - 1)) + 1
          w_pad = floor_ceil((w_mult - w) / 2)
          h_pad = floor_ceil((h_mult - h) / 2)
          d_pad = floor_ceil((d_mult - d) / 2)
          x = F.pad(x, d_pad + w_pad + h_pad)
          pad_sizes = (h_pad, w_pad, d_pad, h_mult, w_mult, d_mult)
  
      else:
          raise ValueError(
              f"only 2D (B,C,H,W) and 3D (B,C,H,W,D) data are supported but x has shape {x.shape}"
          )
  
      return x, pad_sizes
  
file_path: MONAI/monai/apps/reconstruction/networks/nets/utils.py
imports: from __future__ import annotations
  import math
  from torch import Tensor
  from torch.nn import functional
  from monai.apps.reconstruction.complex_utils import complex_conj_t, complex_mul_t
  from monai.networks.blocks.fft_utils_t import fftn_centered_t, ifftn_centered_t
label_desc: Use image node_id 6 for calling a global function with example usage: divisible_pad_t(x, k) and returns: x,  pad_sizes