mirror of
https://github.com/zebrajr/tensorflow.git
synced 2025-12-07 00:20:20 +01:00
Fast path for tf.conj when it should be pass-through.
PiperOrigin-RevId: 171053662
This commit is contained in:
parent
c41dbc3c18
commit
cc8ee6c0f5
|
|
@ -2317,6 +2317,10 @@ def conj(x, name=None):
|
||||||
Raises:
|
Raises:
|
||||||
TypeError: If `x` is not a numeric tensor.
|
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:
|
with ops.name_scope(name, "Conj", [x]) as name:
|
||||||
x = ops.convert_to_tensor(x, name="x")
|
x = ops.convert_to_tensor(x, name="x")
|
||||||
if x.dtype.is_complex or x.dtype == dtypes.variant:
|
if x.dtype.is_complex or x.dtype == dtypes.variant:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user