def _compute_paddings(height_pad_amt, width_pad_amt, patch_axes):
  """Convert the total pad amounts to the format needed by tf.pad()."""

  top_pad = height_pad_amt // 2
  bottom_pad = height_pad_amt - top_pad
  left_pad = width_pad_amt // 2
  right_pad = width_pad_amt - left_pad

  paddings = [[0, 0] for _ in range(4)]
  paddings[patch_axes[0]] = [top_pad, bottom_pad]
  paddings[patch_axes[1]] = [left_pad, right_pad]

  return paddings