简体   繁体   中英

How to compute a large sparse matrix in a single GPU efficiently

I have a very large dataframe named diagnoses. I am trying to do matrix multiplication as below

scores = torch.sparse.mm(diagnoses * freq_adjustment.unsqueeze(0), diagnoses.permute(1, 0))

I want to store the scores in a.pt file using pytorch. But keep getting cuda out of memory error. How to do this efficiently?

In order to benefit from torch.sparse you need your tensors diagnoses and freq_adjustment to be of type sparse tensor . Moreover, if the matrix is not sparse -- it would actually take more space in memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM