我犯了以下错误
MemoryError: Unable to allocate 201. GiB for an array with shape (2999, 2999, 2999) and data type int64
使用以下代码使用Numpy创建网格网格时
dimension=3
tot_length=2000
list_no=range(1, tot_length)
arr = np.meshgrid ( *[list_no for _ in range ( dimension )] )
我可以知道在哪里将int64更改为int32,或者其他可能的设置,允许我最大化大于值2000
的tot_length
数吗
我已经检查了documentation,但是它没有声明将数据类型更改为type32的选项
NumPy猜测
int64
,因为您给它一个range
对象,它需要一个数组,而range
是int
的序列。如果不想让数组猜测,请使用数组:或者更简单地说
当然,您仍然需要100Gib的内存,这仍然相当大
相关问题 更多 >
编程相关推荐