MCPcopy Create free account
hub / github.com/numpy/numpy / abs

Function abs

numpy/array_api/_elementwise_functions.py:19–27  ·  view source on GitHub ↗

Array API compatible wrapper for :py:func:`np.abs `. See its docstring for more information.

(x: Array, /)

Source from the content-addressed store, hash-verified

17
18
19def 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

Callers 15

_sanity_checkFunction · 0.85
test_comparisonsMethod · 0.85
_do_initMethod · 0.85
base_reprFunction · 0.85
within_tolFunction · 0.85
npyv_divisor_s8Function · 0.85
test_mem_aroundMethod · 0.85
test_method_argsMethod · 0.85
bad_arcsinhFunction · 0.85
test_sincos_overlapsMethod · 0.85

Calls 1

_newMethod · 0.80

Tested by 15

test_comparisonsMethod · 0.68
test_mem_aroundMethod · 0.68
test_method_argsMethod · 0.68
bad_arcsinhFunction · 0.68
test_sincos_overlapsMethod · 0.68
test_against_cmathMethod · 0.68
checkMethod · 0.68
test_refcountMethod · 0.68
test_scott_vs_stoneMethod · 0.68
_stride_comb_iterFunction · 0.68
doMethod · 0.68