dask.array.shape

dask.array.shape

dask.array.shape(array)[源代码]

返回数组的形状。

此文档字符串是从 numpy.shape 复制的。

Dask 版本可能存在一些不一致性。

参数
aarray_like (Dask 中不支持)

输入数组。

返回
形状整数元组

形状元组的元素给出了相应数组维度的长度。

参见

len

对于 N>=1 的 N-D 数组,len(a) 等同于 np.shape(a)[0]

ndarray.shape

等效的数组方法。

示例

>>> import numpy as np  
>>> np.shape(np.eye(3))  
(3, 3)
>>> np.shape([[1, 3]])  
(1, 2)
>>> np.shape([0])  
(1,)
>>> np.shape(0)  
()
>>> a = np.array([(1, 2), (3, 4), (5, 6)],  
...              dtype=[('x', 'i4'), ('y', 'i4')])
>>> np.shape(a)  
(3,)
>>> a.shape  
(3,)