inner¶
- paddle. inner ( x, y, name=None ) [source]
-
Inner product of two input Tensor.
Ordinary inner product for 1-D Tensors, in higher dimensions a sum product over the last axes.
- Parameters
-
x (Tensor) – An N-D Tensor or a Scalar Tensor. If its not a scalar Tensor, its last dimensions must match y’s.
y (Tensor) – An N-D Tensor or a Scalar Tensor. If its not a scalar Tensor, its last dimensions must match x’s.
name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.
- Returns
-
The inner-product Tensor, the output shape is x.shape[:-1] + y.shape[:-1].
- Return type
-
Tensor
Examples
import paddle x = paddle.arange(1, 7).reshape((2, 3)).astype('float32') y = paddle.arange(1, 10).reshape((3, 3)).astype('float32') out = paddle.inner(x, y) print(out) # ([[14, 32, 50], # [32, 77, 122]])