Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PyTorch torch.dot function

PyTorch torch.dot function


PyTorch torch reference manual PyTorch torch reference manual

torch.dot is a PyTorch function for computing the dot product of two vectors.

Function definition

torch.dot(input, other, out)


Usage examples

Example

import

torch

a

=

torch.

tensor

(

[

1

,

2

,

3

]

)

b

=

torch.

tensor

(

[

4

,

5

,

6

]

)

Dot product: 14 + 25 + 3*6 = 32

result

=

torch.

dot

(

a

,

b

)

print

(

result

)

The output is:

tensor(32)


PyTorch torch reference manual PyTorch torch reference manual