def convert_output(xi, xu):
    """
    Converts the output `xu` to the same type as `xi`.

    Parameters
    ----------
    xi : int, float or array_like
        Input to a function which operates on numpy arrays.
    xu : array_like
        Output to a function which operates on numpy arrays.

    Returns
    -------
    xu : int, float or array_like
        Output in the same type as `xi`.
    """

    if isinstance(xi, float):

        return float(xu[0])

    elif isinstance(xi, int):

        return int(xu[0])

    else:

        return xu