Skip to content

Commit

Permalink
implement Tensor._sis_hash
Browse files Browse the repository at this point in the history
  • Loading branch information
albertz committed Mar 10, 2023
1 parent faf28c3 commit af1548a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions returnn/tensor/_tensor_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,15 @@ def __repr__(self):
def __hash__(self):
return id(self)

def _sis_hash(self):
if self.raw_tensor is not None and hasattr(self.raw_tensor, "_sis_hash"):
# noinspection PyProtectedMember
return self.raw_tensor._sis_hash()

from sisyphus.hash import sis_hash_helper # noqa

return sis_hash_helper(self.get_kwargs())

def __getstate__(self):
d = {k: getattr(self, k) for k in self.__slots__}
d["_raw_tensor"] = None # do not store the TF tensors
Expand Down

0 comments on commit af1548a

Please sign in to comment.