Range of values (maximum - minimum) along an axis.
The name of the function comes from the acronym for ‘peak to peak’.
a (array_like) – Input values.
axis (int, optional) – Axis along which to find the peaks. By default, flatten the
out (array_like) – Alternative output tensor in which to place the result. It must
have the same shape and buffer length as the expected output,
but the type of the output values will be cast if necessary.
keepdims (bool, optional) –
If this is set to True, the axes which are reduced are left
in the result as dimensions with size one. With this option,
the result will broadcast correctly against the input array.
If the default value is passed, then keepdims will not be
passed through to the ptp method of sub-classes of
Tensor, however any non-default value will be. If the
sub-class’ method does not implement keepdims any
exceptions will be raised.
ptp – A new tensor holding the result, unless out was
specified, in which case a reference to out is returned.
>>> import mars.tensor as mt
>>> x = mt.arange(4).reshape((2,2))
>>> mt.ptp(x, axis=0).execute()
>>> mt.ptp(x, axis=1).execute()