dot¶
- paddle. dot ( x, y, name=None ) [source]
-
This operator calculates inner product for vectors.
Note
Support 1-d and 2-d Tensor. When it is 2d, the first dimension of this matrix is the batch dimension, which means that the vectors of multiple batches are dotted.
- Parameters
-
x (Tensor) – 1-D or 2-D
Tensor
. Its dtype should befloat32
,float64
,int32
,int64
y (Tensor) – 1-D or 2-D
Tensor
. Its dtype soulde befloat32
,float64
,int32
,int64
name (str, optional) – Name of the output. Default is None. It’s used to print debug info for developers. Details: Name
- Returns
-
the calculated result Tensor.
- Return type
-
Tensor
Examples:
import paddle import numpy as np x_data = np.random.uniform(0.1, 1, [10]).astype(np.float32) y_data = np.random.uniform(1, 3, [10]).astype(np.float32) x = paddle.to_tensor(x_data) y = paddle.to_tensor(y_data) z = paddle.dot(x, y) print(z)