mindspore.numpy.ediff1d
- mindspore.numpy.ediff1d(ary, to_end=None, to_begin=None)[source]
The differences between consecutive elements of a tensor.
- Parameters
- Returns
The differences.
- Raises
TypeError – If inputs have types not specified above.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> import mindspore.numpy as np >>> arr = np.array([1, 3, -1, 0, 4]) >>> print(np.ediff1d(arr)) [ 2 -4 1 4]