-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Labels
featureA request for a proper, new feature.A request for a proper, new feature.high prioritymodule: sparseRelated to torch.sparseRelated to torch.sparsetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
🚀 Feature
I want to be able to save a model with sparse tensors.
Motivation
I have a module where one of the parameters may be sparse. (It is an option)
All of the parameters are stored with register_buffer, so they are present in the state dict. But when one of them are sparse it cannot be saved to disk.
It throws the error RuntimeError: sparse tensors do not have storage for example simply on torch.save(torch.sparse.FloatTensor(), 'sparse.pt').
Pitch
It would be nice if the sparse matrices worked interchangeably with the dense counterparts.
torch.save(torch.sparse.FloatTensor(), 'sparse.pt') should just store the tensor.
Alternatives
Alternatively a quick fix would be to simply convert the tensor to dense and then store that.
duncster94, cloudyyyyy, colesbury, nsturis, egdenis and 10 more
Metadata
Metadata
Assignees
Labels
featureA request for a proper, new feature.A request for a proper, new feature.high prioritymodule: sparseRelated to torch.sparseRelated to torch.sparsetriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module