dpnp.tensor.diff¶
- dpnp.tensor.diff(x, /, *, axis=-1, n=1, prepend=None, append=None)[source]¶
Calculates the n-th discrete forward difference of x along axis.
- Parameters:
x (usm_ndarray) -- Input array.
axis (int, optional) --
Axis along which to compute the difference. A valid axis must be on the interval [-N, N), where N is the rank (number of dimensions) of x.
Default:
-1.n (int, optional) --
Number of times to recursively compute the difference.
Default:
1.prepend ({None, usm_ndarray, bool, int, float, complex}, optional) --
Value or values to prepend to the specified axis before taking the difference. Must have the same shape as x except along axis, which can have any shape.
Default:
None.append ({None, usm_ndarray, bool, int, float, complex}, optional) --
Value or values to append to the specified axis before taking the difference. Must have the same shape as x except along axis, which can have any shape.
Default:
None.
- Returns:
out -- An array containing the n-th differences. The array will have the same shape as x, except along axis, which will have shape:
prepend.shape[axis] + x.shape[axis] + append.shape[axis] - nThe data type of the returned array is determined by the Type Promotion Rules.
- Return type: