cupy.diff#
- cupy.diff(a, n=1, axis=-1, prepend=None, append=None)[source]#
Calculate the n-th discrete difference along the given axis.
- Parameters:
a (cupy.ndarray) – Input array.
n (int) – The number of times values are differenced. If zero, the input is returned as-is.
axis (int) – The axis along which the difference is taken, default is the last axis.
prepend (int, float, cupy.ndarray) – Value to prepend to
a
.append (int, float, cupy.ndarray) – Value to append to
a
.
- Returns:
The result array.
- Return type:
See also