理解numpy.power

  • numpy.power

    numpy.power(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])=<ufunc 'power'>

    First array elements raised to powers from second array, element-wise.

    Raise each base in x1 to the positionally-corresponding power in x2.

    x1 and x2 must be broadcastable to the same shape.

    Note that an integer type raised to a negative integer power will raise a ValueError.

  • Parameters

    para type meaning
    x1 array_like the bases
    x2 array_like the exponents.
    If x1.shape!=x2.shape, they must be broadcastable to a common shape(which becomes the shape of the output)
    out ndarray,None, or tuple of ndarray and None, optional A location into which the result is stored.
    where array_like, optional
    **kwargs Optional keyword arguments

    Returns y which is ndarray. The bases in x1 raised to the exponent in x2. It is a scalar if both x1 and x2 are scalars.

猜你喜欢

转载自blog.csdn.net/The_Time_Runner/article/details/109230486