什么是numpy的数组的最大尺寸? [英] What's the maximum size of a numpy array?

查看:989
本文介绍了什么是numpy的数组的最大尺寸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图创建一个包含2 708 000 000元素的矩阵。当我尝试建立这种规模的numpy的数组它给了我一个值误差。有没有什么办法可以增加最大数组大小?

I'm trying to create a matrix containing 2 708 000 000 elements. When I try to create a numpy array of this size it gives me a value error. Is there any way I can increase the maximum array size?

ValueError错误回溯(最近通话最后一个)

ValueError Traceback (most recent call last)

ValueError错误:允许的最大规模​​突破

ValueError: Maximum allowed size exceeded

推荐答案

您想创建2.7十亿项的数组。如果你正在运行64位numpy的,在每个条目8个字节,这将是20 GB的所有。

You're trying to create an array with 2.7 billion entries. If you're running 64-bit numpy, at 8 bytes per entry, that would be 20 GB in all.

所以,几乎可以肯定你刚才跑出来的内存的机器上。有一个在numpy的没有一般最大的数组大小。

So almost certainly you just ran out of memory on your machine. There is no general maximum array size in numpy.

这篇关于什么是numpy的数组的最大尺寸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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