有时会遇到如下shape的array
>>> a = np.zeros([0, 10])
>>> a
array([], shape=(0, 10), dtype=float64)
>>> b = np.zeros([0, 2, 2])
>>> b
array([], shape=(0, 2, 2), dtype=float64)
这时a 和 b都是空数组。
那为什么要规定shape呢,
为了以后用什么shape来填充这个数组提供可读性。
本文介绍了如何理解NumPy中形状为(0, n)的空数组,并解释了为什么需要预先定义这样的形状。这对于后续的数据填充提供了便利性和一致性。
有时会遇到如下shape的array
>>> a = np.zeros([0, 10])
>>> a
array([], shape=(0, 10), dtype=float64)
>>> b = np.zeros([0, 2, 2])
>>> b
array([], shape=(0, 2, 2), dtype=float64)
这时a 和 b都是空数组。
那为什么要规定shape呢,
为了以后用什么shape来填充这个数组提供可读性。
2139

被折叠的 条评论
为什么被折叠?