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.
represents the conjugate for complex vectors, and is the raw value for real vectors.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])