mindspore.numpy.outer
- mindspore.numpy.outer(a, b)[源代码]
- Computes the outer product of two vectors. - Given two vectors, - a = [a0, a1, ..., aM]and- b = [b0, b1, ..., bN], the outer product is:- [[a0*b0 a0*b1 ... a0*bN ]- [a1*b0 . ]- [ ... . ]- [aM*b0 aM*bN ]]- 说明 - Numpy argument - outis not supported. On GPU, the supported dtypes are np.float16, and np.float32. On CPU, the supported dtypes are np.float16, np.float32, and np.float64.- 参数
- 返回
- Tensor or scalar, - out[i, j] = a[i] * b[j].
- 异常
- TypeError – If the input is not a tensor. 
 - Supported Platforms:
- Ascend- GPU- CPU
 - 样例 - >>> import mindspore.numpy as np >>> a = np.full(7, 2).astype('float32') >>> b = np.full(4, 3).astype('float32') >>> output = np.outer(a, b) >>> print(output) [[6. 6. 6. 6.] [6. 6. 6. 6.] [6. 6. 6. 6.] [6. 6. 6. 6.] [6. 6. 6. 6.] [6. 6. 6. 6.] [6. 6. 6. 6.]]