小编use*_*163的帖子

Numpy/Python:Meshgrid除法运算:MemoryError

我正在用numpy编程一个神经场,对于一个100*100神经元的地图,我需要管理一个10000*10000的连接图.

所以我用meshgrid创建我的连接图,我尝试应用墨西哥帽功能的改编.在这里,你有你可以尝试的代码:如果你放taille = 60或taille = 70(神经图的宽度),它将工作(在我的电脑上,没关系)但是,如果你尝试taille = 100,你会得到一个MemoryError.

import numpy as np

def connection_map4(width, se1, se2, K, inh):
    x = np.arange(0, width**2, 1)
    y = np.arange(0, width**2, 1)
    X,Y = np.meshgrid(x, y)
    print "Meshgrid cree"
    A1 = 1.0 + inh
    A2 = inh
    # exp(|x-xc|/b + |y-yc|) -> Mexican Hat equation
    # 2D/1D transformation relation: i = width.y + x
    # ligne = (X/witdh - Y/width)**2
    ligne = (X-Y)/width ## empirically, it's the division …
Run Code Online (Sandbox Code Playgroud)

python numpy division

2
推荐指数
1
解决办法
960
查看次数

标签 统计

division ×1

numpy ×1

python ×1