outer

paddle. outer ( x, y, name=None ) [source]

Outer product of two Tensors.

Input is flattened if not already 1-dimensional.

Parameters
  • x (Tensor) – An N-D Tensor or a Scalar Tensor.

  • y (Tensor) – An N-D Tensor or a Scalar Tensor.

  • name (str, optional) – Name for the operation (optional, default is None). For more information, please refer to Name.

Returns

The outer-product Tensor.

Return type

Tensor

Examples

>>> import paddle
>>> x = paddle.arange(1, 4).astype('float32')
>>> y = paddle.arange(1, 6).astype('float32')
>>> out = paddle.outer(x, y)
>>> print(out)
Tensor(shape=[3, 5], dtype=float32, place=Place(cpu), stop_gradient=True,
[[1. , 2. , 3. , 4. , 5. ],
 [2. , 4. , 6. , 8. , 10.],
 [3. , 6. , 9. , 12., 15.]])