def METHOD_NAME(img, min_size=512):
    h_pad_size = 0
    min_dim = 2 + np.argmin([img.shape[2:4]])
    img_padded = img
    if img.shape[min_dim] < min_size:
        h_pad_size = int((min_size - img.shape[min_dim]) / 2.0)
        if min_dim == 2:
            img_padded = mx.nd.pad(img, mode="constant", constant_value=0,
                                   pad_width=(0, 0, 0, 0, h_pad_size,
                                              h_pad_size, 0, 0))
        else:
            img_padded = mx.nd.pad(img, mode="constant", constant_value=0,
                                   pad_width=(0, 0, 0, 0, 0, 0,
                                              h_pad_size, h_pad_size))
    return img_padded