Array API compatible wrapper for :py:func:`np.abs `. See its docstring for more information.
(x: Array, /)
| 17 | |
| 18 | |
| 19 | def abs(x: Array, /) -> Array: |
| 20 | """ |
| 21 | Array API compatible wrapper for :py:func:`np.abs <numpy.abs>`. |
| 22 | |
| 23 | See its docstring for more information. |
| 24 | """ |
| 25 | if x.dtype not in _numeric_dtypes: |
| 26 | raise TypeError("Only numeric dtypes are allowed in abs") |
| 27 | return Array._new(np.abs(x._array)) |
| 28 | |
| 29 | |
| 30 | # Note: the function name is different here |