评价此页

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)