def numpy_unpad(x, pad_width):
    """Unpad an array.

    Args:
        x (numpy.ndarray): array to unpad
        pad_width (tuple): padding

    Returns:
        numpy.ndarray
    """
    slices = []
    for c in pad_width:
        e = None if c[1] == 0 else -c[1]
        slices.append(slice(c[0], e))
    return x[tuple(slices)]