我不知道在不加载到内存的情况下工作的np.dot。我认为屏蔽会很好。创建一个输出数组(以下称为“ c”)作为pytables
CArray并填写块。创建块形状以匹配其阻止方案时,应选择块形状。就像是
atom = tables.Float32Atom() # you have UInt8Atom() above. do you mean that?shape = (a.shape[0], b.shape[1])# you can vary block_size and chunkshape independently, but I would# aim to have block_size an integer multiple of chunkshape# your mileage may vary and depends on the array size and how you'll# access it in the future.Nchunk = 128 # ?chunkshape = (Nchunk, Nchunk)chunk_multiple = 1block_size = chunk_multiple * Nchunkc = h5f.create_carray(h5.root, 'c', atom, shape, chunkshape=chunkshape)for i_start in range(0, a.shape[0], block_size): for j_start in range(0, b.shape[1], block_size): for k_start in range(0, a.shape[1], block_size): c[i_start:i_start+block_size, j_start:j_start + block_size] += np.dot(a[i_start:i_start + block_size, k_start:k_start + block_size], b[k_start:k_start + block_size, j_start:j_start + block_size]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)