dask中不支持项目分配的解决方法

问题描述 投票:0回答:1

我正在尝试将代码库从numpy数组转换为dask,因为我的numpy数组超出了Memory Error限制。但是,我知道可变数组的功能尚未在dask arrays中实现,所以我越来越NotImplementedError: Item assignment with <class 'tuple'> not supported下面的代码是否有任何解决方法-

for i, mask in enumerate(masks):
    bounds = find_boundaries(mask, mode='inner')
    X2, Y2 = np.nonzero(bounds)
    X2 = da.from_array(X2, 'auto')
    Y2 = da.from_array(Y2, 'auto')
    xSum = (X2.reshape(-1, 1) - X1.reshape(1, -1)) ** 2
    ySum = (Y2.reshape(-1, 1) - Y1.reshape(1, -1)) ** 2
    #Failing on below line
    distMap[:,i] = da.sqrt(xSum + ySum).min(axis=0)

    break

[我还尝试以黄昏方式计算所有其他计算,并使用distMap作为numpy数组,但仍然得到Memory Error。欢迎任何解决方法。

python python-3.x dask dask-distributed
1个回答
0
投票

也许您可以构造许多dask数组,然后使用da.concatenateda.stack将它们合并为一个dask数组?

© www.soinside.com 2019 - 2024. All rights reserved.