mindspore.ops.Ger

View Source On Gitee
class mindspore.ops.Ger[source]

Ger product of x1 and x2. Calculate the outer product of two arrays. If x1 is a 1D Tensor of shape \((m,)\) and x2 is a 1D Tensor of shape \((n,)\), then output must be a 2D Tensor of shape \((m, n)\).

Refer to mindspore.ops.ger() for more details.

Inputs:
  • x1 - (Tensor) - 1-D input Tensor.

  • x2 - (Tensor) - 1-D input Tensor, has the same dtype as x1.

Outputs:

Tensor, output matrix with the same dtype as inputs.With x1 shape \((m,)\) and x2 shape of \((n,)\),the output has shape \((m, n)\).

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> from mindspore import Tensor, ops
>>> x1 = Tensor([1., 2., 3., 4.], mindspore.float32)
>>> x2 = Tensor([1., 2., 3.], mindspore.float32)
>>> ger = ops.Ger()
>>> output = ger(x1, x2)
>>> print(output)
[[ 1.  2.  3.]
 [ 2.  4.  6.]
 [ 3.  6.  9.]
 [ 4.  8. 12.]]