dpnp.abs¶
- dpnp.abs = <DPNPUnaryFunc 'abs'>¶
Calculates the absolute value for each element \(x_i\) of input array x.
For full documentation refer to
numpy.absolute.- Parameters:
- x{dpnp.ndarray, usm_ndarray}
Input array, may have any data type.
- out{None, dpnp.ndarray, usm_ndarray, tuple of ndarray}, optional
Output array to populate. Array must have the correct shape and the expected data type. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
Default:
None.- order{None, "C", "F", "A", "K"}, optional
Memory layout of the newly output array, if parameter out is
None.Default:
"K".
- Returns:
- outdpnp.ndarray
An array containing the element-wise absolute values. For complex input, the absolute value is its magnitude. If x has a real-valued data type, the returned array has the same data type as x. If x has a complex floating-point data type, the returned array has a real-valued floating-point data type whose precision matches the precision of x.
Limitations
Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise
NotImplementedErrorexception will be raised.See also
dpnp.fabsCalculate the absolute value element-wise excluding complex types.
Notes
dpnp.absoluteis an equivalent function.Examples
>>> import dpnp as np >>> a = np.array([-1.2, 1.2]) >>> np.abs(a) array([1.2, 1.2])
>>> a = np.array(1.2 + 1j) >>> np.abs(a) array(1.5620499351813308)