Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.real function

PyTorch torch.real function


PyTorch torch reference manual 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

)

print

(

result

)


PyTorch torch reference manual PyTorch torch reference manual