Array API compatible wrapper for :py:func:`np.power `. See its docstring for more information.
(x1: Array, x2: Array, /)
| 611 | |
| 612 | # Note: the function name is different here |
| 613 | def pow(x1: Array, x2: Array, /) -> Array: |
| 614 | """ |
| 615 | Array API compatible wrapper for :py:func:`np.power <numpy.power>`. |
| 616 | |
| 617 | See its docstring for more information. |
| 618 | """ |
| 619 | if x1.dtype not in _numeric_dtypes or x2.dtype not in _numeric_dtypes: |
| 620 | raise TypeError("Only numeric dtypes are allowed in pow") |
| 621 | # Call result type here just to raise on disallowed type combinations |
| 622 | _result_type(x1.dtype, x2.dtype) |
| 623 | x1, x2 = Array._normalize_two_args(x1, x2) |
| 624 | return Array._new(np.power(x1._array, x2._array)) |
| 625 | |
| 626 | |
| 627 | def real(x: Array, /) -> Array: |