PyTorch torch.real function
PyTorch torch reference manual
torch.real is a function in PyTorch used to return the real part of a complex tensor.
Function definition
torch.real(input)
Usage examples
Example
import
torch
Return the real part of a complex tensor
x
=
torch.
tensor
(
[
1
+2j
,
3
+4j
,
5
+6j
]
)
result
=
torch.
real
(
x
)
(
result
)