Added __hash__ function to boundedtensorspec

PiperOrigin-RevId: 277569874
Change-Id: I84066386db50dd1a5ee05075f13f14f33f896016
This commit is contained in:
A. Unique TensorFlower 2019-10-30 13:13:53 -07:00 committed by TensorFlower Gardener
parent 235e1ff472
commit f04053d46d

View File

@ -279,6 +279,9 @@ class BoundedTensorSpec(TensorSpec):
return (tensor_spec_eq and np.allclose(self.minimum, other.minimum) and
np.allclose(self.maximum, other.maximum))
def __hash__(self):
return hash((self._shape_tuple, self.dtype))
def __reduce__(self):
return BoundedTensorSpec, (self._shape, self._dtype, self._minimum,
self._maximum, self._name)