dpnp.atleast_1d

dpnp.atleast_1d(*arys)[source]

Convert inputs to arrays with at least one dimension.

For full documentation refer to numpy.atleast_1d.

Parameters:

arys ({dpnp.ndarray, usm_ndarray}) -- One or more array-like sequences. Arrays that already have one or more dimensions are preserved.

Returns:

out -- An array, or list of arrays, each with a.ndim >= 1. Copies are made only if necessary.

Return type:

dpnp.ndarray

See also

dpnp.atleast_2d

View inputs as arrays with at least two dimensions.

dpnp.atleast_3d

View inputs as arrays with at least three dimensions.

Examples

>>> import dpnp as np
>>> x = np.array(1.0)
>>> np.atleast_1d(x)
array([1.])
>>> y = np.array([3, 4])
>>> np.atleast_1d(x, y)
[array([1.]), array([3, 4])]
>>> x = np.arange(9.0).reshape(3,3)
>>> np.atleast_1d(x)
array([[0., 1., 2.],
       [3., 4., 5.],
       [6., 7., 8.]])
>>> np.atleast_1d(x) is x
True