dpnp.fabs

dpnp.fabs(x, out=None, where=True, order='K', dtype=None, subok=True, **kwargs)

Compute the absolute values element-wise.

This function returns the absolute values (positive magnitude) of the data in x. Complex values are not handled, use dpnp.absolute to find the absolute values of complex data.

For full documentation refer to numpy.fabs.

Parameters:
  • x ({dpnp.ndarray, usm_ndarray}) -- The array of numbers for which the absolute values are required.

  • out ({None, dpnp.ndarray, usm_ndarray}, optional) -- Output array to populate. Array must have the correct shape and the expected data type. Default: None.

  • order ({"C", "F", "A", "K"}, optional) -- Memory layout of the newly output array, if parameter out is None. Default: "K".

Returns:

out -- The absolute values of x, the returned values are always floats. If x does not have a floating point data type, the returned array will have a data type that depends on the capabilities of the device on which the array resides.

Return type:

dpnp.ndarray

Limitations

Parameters where and subok are supported with their default values. Keyword argument kwargs is currently unsupported. Otherwise NotImplementedError exception will be raised.

See also

dpnp.absolute

Absolute values including complex types.

Examples

>>> import dpnp as np
>>> a = np.array([-1.2, 1.2])
>>> np.fabs(a)
array([1.2, 1.2])