torch.vdot
- torch.vdot(input, other, *, out=None) → Tensor
Computes the dot product of two 1D vectors along a dimension.
In symbols, this function computes
Computes the dot product of two 1D vectors along a dimension.
In symbols, this function computes
where denotes the conjugate for complex vectors, and it is the identity for real vectors.
Keyword args:
Example:
>>> torch.vdot(torch.tensor([2, 3]), torch.tensor([2, 1]))
tensor(7)
>>> a = torch.tensor((1 +2j, 3 - 1j))
>>> b = torch.tensor((2 +1j, 4 - 0j))
>>> torch.vdot(a, b)
tensor([16.+1.j])
>>> torch.vdot(b, a)
tensor([16.-1.j])