Fast-path for EagerTensorBase.dtype

PiperOrigin-RevId: 170933005
This commit is contained in:
Alexandre Passos 2017-10-03 16:24:33 -07:00 committed by TensorFlower Gardener
parent 08e266d9b5
commit b925f8553c

View File

@ -582,7 +582,9 @@ class _EagerTensorBase(Tensor):
@property
def dtype(self):
return dtypes.as_dtype(self._datatype_enum())
# Note: using the intern table directly here as this is
# performance-sensitive in some models.
return dtypes._INTERN_TABLE[self._datatype_enum()] # pylint: disable=protected-access
def _numpy_text(self, is_repr=False):
if self.dtype.is_numpy_compatible: