mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Preserve coalesce state in sparse COO tensor serialization (#102647)
Fixes #101186 Also, resolves the "serialization to preserve coalesced-ness" part in https://github.com/pytorch/pytorch/issues/73479 Pull Request resolved: https://github.com/pytorch/pytorch/pull/102647 Approved by: https://github.com/mikaylagawarecki
This commit is contained in:
committed by
PyTorch MergeBot
parent
ec4a107f87
commit
39b04370db
@ -316,7 +316,7 @@ class SerializationMixin:
|
||||
torch.save({"tensor": x}, f)
|
||||
f.seek(0)
|
||||
y = torch.load(f, weights_only=weights_only)
|
||||
self.assertEqual(x, y["tensor"])
|
||||
self.assertEqual(x, y["tensor"], exact_is_coalesced=True)
|
||||
_test_serialization(lambda x: x.to_sparse())
|
||||
_test_serialization(lambda x: x.to_sparse_csr())
|
||||
_test_serialization(lambda x: x.to_sparse_csc())
|
||||
|
Reference in New Issue
Block a user