def get_padding(shape1, shape2):
  """ Return the padding needed to convert shape2 to shape1 """
  assert len(shape1) == len(shape2)
  h_diff, w_diff = shape1[1] - shape2[1], shape1[2] - shape2[2]
  padding_left = w_diff // 2
  padding_right = w_diff - padding_left
  padding_top = h_diff // 2
  padding_bottom = h_diff - padding_top
  return (padding_left, padding_right, padding_top, padding_bottom)