torch.linalg.vecdot
- torch.linalg.vecdot(x, y, *, dim=-1, out=None) → Tensor
Computes the dot product of two batches of vectors along a dimension.
Computes the dot product of two batches of vectors along a dimension.
In symbols, this function computes
over the dimension dim where denotes the conjugate for complex
vectors, and it is the identity for real vectors.
Supports input of half, bfloat16, float, double, cfloat, cdouble and integral dtypes. It also supports broadcasting.
Examples:
>>> v1 = torch.randn(3, 2)
>>> v2 = torch.randn(3, 2)
>>> linalg.vecdot(v1, v2)
tensor([ 0.3223, 0.2815, -0.1944])
>>> torch.vdot(v1[0], v2[0])
tensor(0.3223)