dpnp.ones_like
- dpnp.ones_like(x1, dtype=None, order='C', subok=False, shape=None)[source]
Return an array of ones with the same shape and type as a given array.
For full documentation refer to
numpy.ones_like.Limitations
Parameter
orderis supported only with default value"C". Parametersubokis supported only with default valueFalse.See also
dpnp.empty_likeReturn an empty array with shape and type of input.
dpnp.zeros_likeReturn an array of zeros with shape and type of input.
dpnp.full_likeReturn a new array with shape of input filled with value.
dpnp.onesReturn a new array setting values to one.
Examples
>>> import dpnp as np >>> x = np.arange(6) >>> [i for i in x] [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] >>> [i for i in np.ones_like(x)] [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]