Fast path for tf.conj when it should be pass-through.

PiperOrigin-RevId: 171053662
This commit is contained in:
Alexandre Passos 2017-10-04 13:26:11 -07:00 committed by TensorFlower Gardener
parent c41dbc3c18
commit cc8ee6c0f5

View File

@ -2317,6 +2317,10 @@ def conj(x, name=None):
Raises:
TypeError: If `x` is not a numeric tensor.
"""
if isinstance(x, ops.Tensor):
dt = x.dtype
if dt.is_floating or dt.is_integer:
return x
with ops.name_scope(name, "Conj", [x]) as name:
x = ops.convert_to_tensor(x, name="x")
if x.dtype.is_complex or x.dtype == dtypes.variant: