xorbits.numpy.atleast_2d#
- xorbits.numpy.atleast_2d(*tensors)[源代码]#
View inputs as arrays with at least two dimensions.
- 参数
arys1 (array_like) – One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
arys2 (array_like) – One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
... (array_like) – One or more array-like sequences. Non-array inputs are converted to arrays. Arrays that already have two or more dimensions are preserved.
- 返回
res, res2, … – An array, or list of arrays, each with
a.ndim >= 2
. Copies are avoided where possible, and views with two or more dimensions are returned.- 返回类型
ndarray
参见
实际案例
>>> np.atleast_2d(3.0) array([[3.]])
>>> x = np.arange(3.0) >>> np.atleast_2d(x) array([[0., 1., 2.]]) >>> np.atleast_2d(x).base is x True
>>> np.atleast_2d(1, [1, 2], [[1, 2]]) [array([[1]]), array([[1, 2]]), array([[1, 2]])]
This docstring was copied from numpy.