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 order is supported only with default value "C". Parameter subok is supported only with default value False.

See also

dpnp.empty_like

Return an empty array with shape and type of input.

dpnp.zeros_like

Return an array of zeros with shape and type of input.

dpnp.full_like

Return a new array with shape of input filled with value.

dpnp.ones

Return 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]