dpnp.round
- dpnp.round(x, decimals=0, out=None)[source]
Evenly round to the given number of decimals.
For full documentation refer to
numpy.round.- Returns:
out – The rounded value of elements of the array.
- Return type:
dpnp.ndarray
Limitations
Parameter x is only supported as either
dpnp.ndarrayordpctl.tensor.usm_ndarray. Parameters decimals is supported with its default value. Otherwise the function will be executed sequentially on CPU. Input array data types are limited by supported DPNP Data types.See also
dpnp.aroundEquivalent function; see for details.
dpnp.ndarray.roundEquivalent function.
dpnp.rintRound elements of the array to the nearest integer.
dpnp.ceilCompute the ceiling of the input, element-wise.
dpnp.floorReturn the floor of the input, element-wise.
dpnp.truncReturn the truncated value of the input, element-wise.
Examples
>>> import dpnp as np >>> np.round(np.array([0.37, 1.64])) array([0., 2.]) >>> np.round(np.array([0.37, 1.64]), decimals=1) array([0.4, 1.6]) >>> np.round(np.array([.5, 1.5, 2.5, 3.5, 4.5])) # rounds to nearest even value array([0., 2., 2., 4., 4.]) >>> np.round(np.array([1,2,3,11]), decimals=1) # ndarray of ints is returned array([ 1, 2, 3, 11]) >>> np.round(np.array([1,2,3,11]), decimals=-1) array([ 0, 0, 0, 10])