我正在尝试将代码库从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
。欢迎任何解决方法。
也许您可以构造许多dask数组,然后使用da.concatenate
或da.stack
将它们合并为一个dask数组?