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

PyTorch torch.resolve_conj function

PyTorch torch.resolve_conj function


PyTorch torch reference manual PyTorch torch reference manual

torch.resolve_conj is a function in PyTorch used to resolve conjugate views. If the input tensor is a view of a conjugate complex number, the function returns the actual tensor data; otherwise it returns the original tensor directly.

Function definition

torch.resolve_conj(input)


Usage examples

Example

import

torch

Create a complex tensor

x

=

torch.

randn

(

3

,

dtype

=

torch.

complex64

)

Get a conjugate view

x_conj

=

torch.

conj

(

x

)

Resolve the conjugate

resolved

=

torch.

resolve_conj

(

x_conj

)

print

(

"Original tensor:"

,

x

)

print

(

"Conjugate view:"

,

x_conj

)

print

(

"After resolving:"

,

resolved

)

The output is:

原始张量: tensor([ 1.2345+0.5678j, -2.3456+1.2345j,  3.4567-0.9876j])

共轭视图: tensor([ 1.2345-0.5678j, -2.3456-1.2345j,  3.4567+0.9876j])

解析后: tensor([ 1.2345-0.5678j, -2.3456-1.2345j,  3.4567+0.9876j])


PyTorch torch reference manual PyTorch torch reference manual