diff options
author | Alexandre Passos <apassos@google.com> | 2017-10-04 13:26:11 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2017-10-04 13:32:29 -0700 |
commit | 15155493b941a28d2d9c1e1cb1ed5873612b360a (patch) | |
tree | e87a9d16bfddd9102c1c3269b68aec841206b88c | |
parent | 6c954d0b3f02ea586a5fd3f9c2ea13bf8473d17f (diff) |
Fast path for tf.conj when it should be pass-through.
PiperOrigin-RevId: 171053662
-rw-r--r-- | tensorflow/python/ops/math_ops.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tensorflow/python/ops/math_ops.py b/tensorflow/python/ops/math_ops.py index 131f3724eb..9383d72f14 100644 --- a/tensorflow/python/ops/math_ops.py +++ b/tensorflow/python/ops/math_ops.py @@ -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: |