我正在尝试在一些大型阵列中做一些真正的 fft 并决定尝试 dask。我遇到了一个问题,无论我做什么,函数 dask.array.rfft 似乎都不起作用。这是一个最小的例子。
import numpy as np
import dask.array as da
import dask
print('Dask version: {}'.format(dask.__version__))
x = np.random.random((10, 10))
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_fft = da.fft.fft(dx)
dx_ifft = da.fft.ifft(dx_fft)
dx_ifft.compute()
print('Regular fft worked out just fine.')
dx = da.from_array(x, chunks=(2, x.shape[1]))
dx_rfft = da.fft.rfft(dx, axis=1)
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
dx_irfft.compute()
print('Real fft worked out just fine.')
程序的输出是。
Dask version: 0.7.5
Regular fft worked out just fine.
Traceback (most recent call last):
File "a.py", line 16, in <module>
dx_irfft = da.fft.irfft(dx_rfft, axis=1)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/fft.py", line 35, in func
chunks=chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 449, in map_blocks
result = atop(func, out_ind, *args, name=name, dtype=dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1420, in atop
chunkss, arrays = unify_chunks(*args)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1342, in unify_chunks
for a, i in arginds]
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/core.py", line 1141, in rechunk
return rechunk(self, chunks)
File "/home/heitor/anaconda/lib/python2.7/site-packages/dask/array/rechunk.py", line 232, in rechunk
return Array(x2, temp_name, chunks, dtype=x.dtype)
File "/home/heitor/anaconda/lib/python2.7/site-packages/toolz/functoolz.py", line 348, in memof
raise TypeError("Arguments to memoized function must be hashable")
TypeError: Arguments to memoized function must be hashable
无论我尝试对 dx_rfft 执行什么操作,它都会返回相同的错误。我试过 Pythons 2 和 3 并且都有同样的问题。我错过了什么还是图书馆的错误?