【发布时间】:2014-06-24 11:33:09
【问题描述】:
我有一个使用 numpy memmap 的矩阵乘法代码
def test_memmap():
fA = np.lib.format.open_memmap('A.npy', dtype='uint8', mode='r+')
fB = np.lib.format.open_memmap('B.npy', dtype='uint8', mode='r+')
#need to predefine size of result?
#fC = np.memmap('C.npy', dtype='uint16', mode='w+', shape=(rows,rows))
# print fA
# print fB
#where it stored if not gived filename?
t0= time.time()
fC= np.dot(fA,fB)
print (time.time()-t0)
print fC.filename
print type(fC)
# print fC[12:10]
# print fC
运行后memmap文件fC在哪里?以及如何指定保存路径?
如何指出保存 fC 的位置(而不是将其存储在内存中)?可以自动检测数组的类型和大小吗?
【问题讨论】:
标签: python numpy memory large-data