mindspore.mint.outer

View Source On AtomGit
mindspore.mint.outer(input, vec2)[source]

Compute outer product of two tensors. If input is a vector of size \(n\) and vec2 is a vector of size \(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

Examples

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