Skip to content

Commit

Permalink
Override PTensor save/load. Fixes #128
Browse files Browse the repository at this point in the history
  • Loading branch information
tabasavr authored and jcmgray committed Jul 6, 2022
1 parent 31eae5e commit fac3a05
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions quimb/tensor/tensor_core.py
Expand Up @@ -8535,6 +8535,15 @@ def unparametrize(self):
"""
return Tensor(self)

def __getstate__(self):
# Save _parray directly
return self._parray, self._inds, self._tags, self._left_inds

def __setstate__(self, state):
self._parray, self._inds, tags, self._left_inds = state
self._tags = tags.copy()
self._owners = {}


class IsoTensor(Tensor):
"""A ``Tensor`` subclass which keeps its ``left_inds`` by default even
Expand Down

0 comments on commit fac3a05

Please sign in to comment.