mindspore.Tensor.ger
- Tensor.ger(x)[source]
Ger product of self and x. Calculate the outer product of two arrays. If self is a 1D Tensor of shape \((m,)\) and x is a 1D Tensor of shape \((n,)\), then output must be a Tensor of shape \((m, n)\).
Note
Currently Ascend does not support float64 data input.
Refer to
mindspore.ops.ger()
for more detail.- Parameters
x (Tensor) – input Tensor, with dtype of float16, float32 or float64.
- Returns
Tensor, output matrix with the same dtype as inputs.With self shape \((m,)\) and x shape of \((n,)\), the output has shape \((m, n)\).
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x1 = Tensor([1., 2., 3., 4.], mindspore.float32) >>> x2 = Tensor([1., 2., 3.], mindspore.float32) >>> output = x1.ger(x2) >>> print(output) [[ 1. 2. 3.] [ 2. 4. 6.] [ 3. 6. 9.] [ 4. 8. 12.]]