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

Method __abs__

numpy/array_api/_array_object.py:425–432  ·  view source on GitHub ↗

Performs the operation __abs__.

(self: Array, /)

Source from the content-addressed store, hash-verified

423 # Everything below this line is required by the spec.
424
425 def __abs__(self: Array, /) -> Array:
426 """
427 Performs the operation __abs__.
428 """
429 if self.dtype not in _numeric_dtypes:
430 raise TypeError("Only numeric dtypes are allowed in __abs__")
431 res = self._array.__abs__()
432 return self.__class__._new(res)
433
434 def __add__(self: Array, other: Union[int, float, Array], /) -> Array:
435 """

Callers

nothing calls this directly

Calls 1

_newMethod · 0.80

Tested by

no test coverage detected