ger
- paddle. ger ( x: Tensor, y: Tensor, name: str | None = None, *, out: Tensor | None = None ) Tensor
-
Outer product of two Tensors.
Input is flattened if not already 1-dimensional.
Note
Alias Support: The parameter name
input
can be used as an alias forx
, andvec2
can be used as an alias fory
. For example,outer(input=tensor_x, vec2=tensor_y, ...)
is equivalent toouter(x=tensor_x, y=tensor_y, ...)
.- Parameters
-
x (Tensor) – An N-D Tensor or a Scalar Tensor. alias:
input
.y (Tensor) – An N-D Tensor or a Scalar Tensor. alias:
vec2
.name (str|None, optional) – Name for the operation (optional, default is None). For more information, please refer to api_guide_Name.
out (Tensor|None, optional) – The output Tensor. If set, the result will be stored in this Tensor.
- 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.]])