PyTorch torch.dot Function
PyTorch torch Reference Manual
torch.dotIt is a function in PyTorch used to compute the dot product of two vectors.
Function Definition
torch.dot(input, other, out)
Usage Example
Example
import torch
a = torch.tensor([1, 2, 3])
b = torch.tensor([4, 5, 6])
# Dot product: 1*4 + 2*5 + 3*6 = 32
result = torch.dot(a, b)
print(result)
a = torch.tensor([1, 2, 3])
b = torch.tensor([4, 5, 6])
# Dot product: 1*4 + 2*5 + 3*6 = 32
result = torch.dot(a, b)
print(result)
The output is:
tensor(32)
Other Extensions