簡體   English   中英

Python:dask數組的點積

[英]Python : Dot product of dask array

我正在嘗試做非常大的 2 dask 數組 X (35000 x 7500) 和 Y(7500 x 10) 的點積。 由於點積也會非常大,我將它存儲在 hdf5 中

f = h5py.File('output.hdf5')
f['output'] = X.dot(Y)

但是第二個命令即使將近 1 小時也沒有給出任何輸出。 怎么了? 有更快的技術嗎? 創建 X 和 Y 時是否存在“塊”問題?

考慮.to_hdf5方法或da.store函數。

>>> X.dot(Y).to_hdf5('output.hdf5', 'output')

或者

>>> output = f.create_dataset('/output', X.dot(Y).shape, X.dot(Y).dtype)
>>> da.store(X.dot(Y), output)

to_hdf5方法對您來說可能更容易。 da.store方法也適用於其他格式。

H5Py 中的__setitem__函數(當您說f['output'] = ...時正在使用的函數被硬編碼為使用 NumPy 數組。

這是文檔中的相應部分。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM