dpnp.ones
- dpnp.ones(shape, dtype=None, order='C')[source]
Return a new array of given shape and type, filled with ones.
For full documentation refer to
numpy.ones.Limitations
Parameter
orderis supported only with default value"C".See also
dpnp.ones_likeReturn an array of ones with shape and type of input.
dpnp.emptyReturn a new uninitialized array.
dpnp.zerosReturn a new array setting values to zero.
dpnp.fullReturn a new array of given shape filled with value.
Examples
>>> import dpnp as np >>> [i for i in np.ones(5)] [1.0, 1.0, 1.0, 1.0, 1.0] >>> x = np.ones((2, 1)) >>> x.ndim, x.size, x.shape (2, 2, (2, 1)) >>> [i for i in x] [1.0, 1.0]