使用具有大量维的numpy.array [英] Using numpy.array with large number of dimensions

查看:81
本文介绍了使用具有大量维的numpy.array的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您尝试在numpy中创建具有大量维的数组,则会引发异常:

If you try to make an array with large number of dimensions in numpy, it throws an exception:

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

有没有简单的解决方法?

Are there any simple workarounds to this?

numpy不允许创建此类数组的原因是什么?

What are the reasons why numpy doesn't allow creating such arrays?

推荐答案

来自您可以更改这些定义,并从源代码构建满足您需求的不兼容版本.

You could change those defines and build from source a non-compatible version that fits your needs.

这篇关于使用具有大量维的numpy.array的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆