評價此頁

torch.adjoint#

torch.adjoint(input: Tensor) Tensor#

返回一個張量的檢視,該檢視已共軛並按最後兩個維度轉置。

對於複數張量,x.adjoint() 等價於 x.transpose(-2, -1).conj();對於實數張量,則等價於 x.transpose(-2, -1)

引數

{input}

示例

>>> x = torch.arange(4, dtype=torch.float)
>>> A = torch.complex(x, x).reshape(2, 2)
>>> A
tensor([[0.+0.j, 1.+1.j],
        [2.+2.j, 3.+3.j]])
>>> A.adjoint()
tensor([[0.-0.j, 2.-2.j],
        [1.-1.j, 3.-3.j]])
>>> (A.adjoint() == A.mH).all()
tensor(True)