dot¶
-
paddle.fluid.layers.
dot
(x, y, name=None)[source] This operator calculates inner product for vectors.
Note
Only support 1-d Tensor(vector).
- Parameters
x (Variable) – 1-D
Tensor
orLoDTensor
. Its datatype should befloat32
,float64
,int32
,int64
y (Variable) – 1-D
Tensor
orLoDTensor
. Its datatype 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/LoDTensor.
- Return type
Variable
Examples:
import paddle import paddle.fluid as fluid import numpy as np with fluid.dygraph.guard(): x = fluid.dygraph.to_variable(np.random.uniform(0.1, 1, [10]).astype(np.float32)) y = fluid.dygraph.to_variable(np.random.uniform(1, 3, [10]).astype(np.float32)) z = fluid.layers.dot(x, y) print(z.numpy())