如果你试图在numpy中创建一个具有大量维度的数组,它会抛出一个异常:
In [1]: import numpy as np
In [2]: a = np.zeros((1,) * 33)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-2-32dc30f6e439> in <module>()
----> 1 a = np.zeros((1,) * 33)
ValueError: sequence too large; must be smaller than 32
有没有简单的解决方法?
为什么numpy不允许创建这样的数组?
numpy.zeros([2]*33)
甚至无法适应32位地址空间。 - user2357112