mindspore.ops.vecdot
- mindspore.ops.vecdot(x, y, *, axis=- 1)[source]
Calculates the dot product of two batches of vectors along the specified dimension.
Support broadcasting.
The formula of calculation is as follows. \(\bar{x_{i}}\) represents the conjugate for complex vectors, and \(\bar{x_{i}}\) is the raw value for real vectors.
\[\sum_{i=1}^{n} \bar{x_{i}}{y_{i}}\]Warning
This is an experimental API that is subject to change or deletion.
- Parameters
- Keyword Arguments
axis (int) – Specify the axis for computation. Default
-1
.- Returns
Tensor
- Supported Platforms:
Ascend
GPU
CPU
Note
Currently, complex numbers are not supported on GPU.
Examples
>>> import mindspore >>> x = mindspore.tensor([[1, 3], [5, 7], [9, 8]]) >>> y = mindspore.tensor([[4, 5], [6, 7], [3, 2]]) >>> mindspore.ops.vecdot(x, y) Tensor(shape=[3], dtype=Int64, value= [19, 79, 43]) >>> mindspore.ops.vecdot(x, y, axis=0) Tensor(shape=[2], dtype=Int64, value= [61, 80])