mindspore.ops.outer

View Source On Gitee
mindspore.ops.outer(input, vec2)[source]

Compute outer product of two tensors.

If input ’s length is n and vec2 ’s length is m , then output must be a matrix of shape (n,m) .

Note

This function does not broadcast.

Parameters
  • input (Tensor) – The 1-D input tensor.

  • vec2 (Tensor) – The 1-D input tensor.

Returns

Tensor

Supported Platforms:

Ascend GPU CPU

Examples

>>> import mindspore
>>> input = mindspore.tensor([1, 2, 3])
>>> vec2 = mindspore.tensor([4, 5, 6])
>>> mindspore.ops.outer(input, vec2)
Tensor(shape=[3, 3], dtype=Int64, value=
[[ 4,  5,  6],
 [ 8, 10, 12],
 [12, 15, 18]])