dpnp.gradient

dpnp.gradient(x1, *varargs, **kwargs)[source]

Return the gradient of an array.

For full documentation refer to numpy.gradient.

Limitations

Parameter y1 is supported as dpnp.ndarray. Argument varargs[0] is supported as int. Keyword arguments kwargs are currently unsupported. Otherwise the functions will be executed sequentially on CPU. Input array data types are limited by supported DPNP Data types.

Example

>>> import dpnp as np
>>> y = np.array([1, 2, 4, 7, 11, 16], dtype=float)
>>> result = np.gradient(y)
>>> [x for x in result]
[1.0, 1.5, 2.5, 3.5, 4.5, 5.0]
>>> result = np.gradient(y, 2)
>>> [x for x in result]
[0.5, 0.75, 1.25, 1.75, 2.25, 2.5]