MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / conj

Function conj

tensorflow/python/ops/math_ops.py:3416–3455  ·  view source on GitHub ↗

r"""Returns the complex conjugate of a complex number. Given a tensor `input` of complex numbers, this operation returns a tensor of complex numbers that are the complex conjugate of each element in `input`. The complex numbers in `input` must be of the form \\(a + bj\\), where *a* is the r

(x, name=None)

Source from the content-addressed store, hash-verified

3414@dispatch.add_dispatch_support
3415@deprecation.deprecated_endpoints("conj")
3416def conj(x, name=None):
3417 r"""Returns the complex conjugate of a complex number.
3418
3419 Given a tensor `input` of complex numbers, this operation returns a tensor of
3420 complex numbers that are the complex conjugate of each element in `input`. The
3421 complex numbers in `input` must be of the form \\(a + bj\\), where *a* is the
3422 real part and *b* is the imaginary part.
3423
3424 The complex conjugate returned by this operation is of the form \\(a - bj\\).
3425
3426 For example:
3427
3428 # tensor 'input' is [-2.25 + 4.75j, 3.25 + 5.75j]
3429 tf.math.conj(input) ==> [-2.25 - 4.75j, 3.25 - 5.75j]
3430
3431 If `x` is real, it is returned unchanged.
3432
3433 Args:
3434 x: `Tensor` to conjugate. Must have numeric or variant type.
3435 name: A name for the operation (optional).
3436
3437 Returns:
3438 A `Tensor` that is the conjugate of `x` (with the same type).
3439
3440 Raises:
3441 TypeError: If `x` is not a numeric tensor.
3442 """
3443 if isinstance(x, ops.Tensor):
3444 dt = x.dtype
3445 if dt.is_floating or dt.is_integer:
3446 return x
3447 with ops.name_scope(name, "Conj", [x]) as name:
3448 x = ops.convert_to_tensor(x, name="x")
3449 if x.dtype.is_complex or x.dtype == dtypes.variant:
3450 return gen_math_ops.conj(x, name=name)
3451 elif x.dtype.is_floating or x.dtype.is_integer:
3452 return x
3453 else:
3454 raise TypeError("Expected numeric or variant tensor, got dtype %r" %
3455 x.dtype)
3456
3457
3458def _BroadcastShape(op):

Callers 1

matmulFunction · 0.70

Calls 1

name_scopeMethod · 0.45

Tested by

no test coverage detected