mindspore.numpy.multi_dot
- mindspore.numpy.multi_dot(arrays)[源代码]
Computes the dot product of two or more arrays in a single function call, while automatically selecting the fastest evaluation order. multi_dot chains numpy.dot and uses optimal parenthesization of the matrices. For more information, refer to the wiki page. Depending on the shapes of the matrices, this can speed up the multiplication a lot. If the first argument is 1-D, it is treated as a row vector. If the last argument is 1-D, it is treated as a column vector. The other arguments must be 2-D.
说明
Numpy argument out is not supported.
- 参数
arrays (sequence of array_like) – If the first argument is 1-D, it is treated as row vector. If the last argument is 1-D, it is treated as column vector. The other arguments must be 2-D.
- 返回
Tensor, the dot product of the supplied arrays.
- 异常
ValueError – arrays are not 2-D.
- Supported Platforms:
Ascend
GPU
CPU
样例
>>> import mindspore.numpy as np >>> A = np.ones((10000, 100)) >>> B = np.ones((100, 100)) >>> C = np.ones((100, 5)) >>> D = np.ones((5, 333)) >>> output = np.multi_dot([A, B, C, D]) >>> print(output) [[50000. 50000. 50000. ... 50000. 50000. 50000.] [50000. 50000. 50000. ... 50000. 50000. 50000.] [50000. 50000. 50000. ... 50000. 50000. 50000.] ... [50000. 50000. 50000. ... 50000. 50000. 50000.] [50000. 50000. 50000. ... 50000. 50000. 50000.] [50000. 50000. 50000. ... 50000. 50000. 50000.]]