mxnet.np.absolute

absolute(x, out=None, **kwargs)

Calculate the absolute value element-wise. np.abs is a shorthand for this function.

Parameters
  • x (ndarray) – Input array.

  • out (ndarray, optional) – A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.

Returns

absolute – An ndarray containing the absolute value of each element in x.

Return type

ndarray

Examples

>>> x = np.array([-1.2, 1.2])
>>> np.absolute(x)
array([ 1.2,  1.2])