Compute the absolute value of a complex array. Args: x: Input array/tensor with 2 channels in the last dimension representing real and imaginary parts. Returns: Absolute value along the last dimension Example: .. code-block:: python import num
(x: NdarrayOrTensor)
| 115 | |
| 116 | |
| 117 | def complex_abs(x: NdarrayOrTensor) -> NdarrayOrTensor: |
| 118 | """ |
| 119 | Compute the absolute value of a complex array. |
| 120 | |
| 121 | Args: |
| 122 | x: Input array/tensor with 2 channels in the last dimension representing real and imaginary parts. |
| 123 | |
| 124 | Returns: |
| 125 | Absolute value along the last dimension |
| 126 | |
| 127 | Example: |
| 128 | .. code-block:: python |
| 129 | |
| 130 | import numpy as np |
| 131 | x = np.array([3,4])[np.newaxis] |
| 132 | # the following line prints 5 |
| 133 | print(complex_abs(x)) |
| 134 | """ |
| 135 | return complex_abs_t(x) # type: ignore |
| 136 | |
| 137 | |
| 138 | def complex_mul_t(x: Tensor, y: Tensor) -> Tensor: |
searching dependent graphs…