Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
Using the pytorch serialization handler on sparse Tensors:
import torch
i = torch.LongTensor([[0, 2], [1, 0], [1, 2]])
v = torch.FloatTensor([3, 4, 5 ])
tensor = torch.sparse.FloatTensor(i.t(), v, torch.Size([2,3]))
pyarrow.serialization.register_torch_serialization_handlers(pyarrow.serialization._default_serialization_context)
s = pyarrow.serialize(tensor, context=pyarrow.serialization._default_serialization_context)
Produces this result:
TypeError: can't convert sparse tensor to numpy. Use Tensor.to_dense() to convert to a dense tensor first.
We should provide a way to serialize sparse torch tensors, especially now that we are getting support for sparse Tensors.
Attachments
Issue Links
- links to