PyTorch torch.angle function
PyTorch torch reference manual
torch.angle is a function in PyTorch used to return the phase angle (argument) of a complex tensor. The returned value is in radians, ranging over [-pi, pi].
Function definition
torch.angle(input, out=None)
Usage examples
Example
import
torch
Create a complex tensor
x
=
torch.
tensor
(
[
1
+1j
,
1
+0j
,
0
+1j
,
1
+0j
]
)
Return the phase angle
result
=
torch.
angle
(
x
)
(
result
)
The output is:
tensor([ 0.7854, 0.0000, 1.5708, 3.1416])